Private Sub Picture1_Paint()
Dim ai As Integer
Dim ahInst As Long
Dim mdc As Long
Dim frc As D_RECT
Dim X As Double
Dim Y As Double
Dim r As Double
Dim mdc1 As Long
mdc1 = MainForm.GisEdit.GetMyDC()
If mdc1 < 1 Then
Exit Sub
End If
bGetDispRect mdc1, frc
mdc = bGetMyDCDir(Picture1.hwnd, Picture1.hdc)
If mdc > 0 And MainForm.GisEdit.Project > 0 Then
bSetGraphicsMode Picture1.hwnd, Picture1.hdc
bSetMyDCMode mdc
bSetDispRect mdc, frc
bSetMyDCPalette mdc
bSetOriginalDisp mdc, 0
GisEdit1.GetDispParm X, Y, r
bSetDispParam mdc, X, Y, r
ahInst = MainForm.PrjList.GetAreaInst()
ai = bGetFirstAreaNo(ahInst)
While ai > 0
If bGetAreaType(ai) = REG Then
bDispRegArea mdc, ai, 1
End If
ai = bGetNextAreaNo(ahInst)
Wend
ai = bGetFirstAreaNo(ahInst)
While ai > 0
If bGetAreaType(ai) = LIN Then
bDispLinArea mdc, ai, 1
End If
ai = bGetNextAreaNo(ahInst)
Wend
ai = bGetFirstAreaNo(ahInst)
While ai > 0
If bGetAreaType(ai) = PNT Then
bDispPntArea mdc, ai, 1
End If
ai = bGetNextAreaNo(ahInst)
Wend
bGetDispRect mdc1, frc
Dim dp0 As D_DOT
Dim dp1 As D_DOT
dp0.X = frc.xmin
dp0.Y = frc.ymin
dp1.X = frc.xmax
dp1.Y = frc.ymax
Dim p0 As POINTAPI
Dim p1 As POINTAPI
bSetPenColor mdc, RGB(255, 0, 0)
bLineF mdc, p0.X, p0.Y, p1.X, p0.Y
bLineF mdc, p1.X, p0.Y, p1.X, p1.Y
bLineF mdc, p1.X, p1.Y, p0.X, p1.Y
bLineF mdc, p0.X, p1.Y, p0.X, p0.Y
bCleanPenColor mdc
End If
bDeleteMyDC mdc
MainForm.GisEdit.DeleteMyDC mdc1
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Dim xPos As Double
Dim yPos As Double
Dim frc As D_RECT
Dim mdc As Long
Dim mdc1 As Long
Dim dx As Double
Dim dy As Double
Dim r As Double
Dim xp0 As Double
Dim yp0 As Double
Dim w, h, scale0 As Double
w = Picture1.ScaleWidth
h = Picture1.ScaleHeight
mdc1 = GisEdit1.GetMyDC()
If mdc1 < 1 Then
Exit Sub
End If
bGetDispRect mdc1, frc
bGetDispParam mdc1, xp0, yp0, r
scale0 = w / (frc.xmax - frc.xmin)
dx = CDbl(X) / scale0
dy = CDbl(h - Y) / scale0
xPos = xp0 + dx
yPos = yp0 + dy
mdc = MainForm.GisEdit.GetMyDC()
If mdc < 1 Then
Exit Sub
End If
bGetDispRect mdc, frc
bGetDispParam mdc, w, h, r
w = (frc.xmax - frc.xmin) / 2#
h = (frc.ymax - frc.ymin) / 2#
MainForm.GisEdit.SetDispParm xPos - w, yPos - h, r
MainForm.GisEdit.UpdateWindow
Picture1.Refresh
MainForm.GisEdit.DeleteMyDC mdc
GisEdit1.DeleteMyDC mdc1
End If