|
Option Explicit
Private Sub Form_Load()
Dim i%
For i = 0 To 50
lstStates.AddItem gsStateName(i)
Next i
End Sub
Private Sub cmdSelectAll_Click()
Dim i%
lstStates.Visible = False
gbMassUpdate = True
For i% = 0 To lstStates.ListCount - 1
lstStates.Selected(i) = True
Next i
gbMassUpdate = False
lstStates.Visible = True
PaintShownMapFromList
End Sub
Private Sub cmdClearAll_Click()
Dim i%
lstStates.Visible = False
gbMassUpdate = True
For i% = 0 To lstStates.ListCount - 1
lstStates.Selected(i) = False
Next i
gbMassUpdate = False
lstStates.Visible = True
UpdateThe SHOWN_MAP, BACKUP_MAP
picShown.Refresh
End Sub
Private Sub lstStates_Click()
If gbMassUpdate Then Exit Sub
UpdateThe HIDDEN_MAP, BACKUP_MAP
PaintShownMapFromList
End Sub
Private Function MapStateClicked%()
Dim i%
For i = 0 To 60
If GetPixel(picHidden.hdc, giaX(i), giaY(i)) = _
DARK_GRAY Then Exit For
Next i
Select Case i
Case 1, 51 To 54
i = 1
Case 7, 55
i = 7
Case 11, 56 To 59
i = 11
Case 22, 60
i = 22
End Select
MapStateClicked = i
End Function
Private Sub ClearState()
Dim i&
UpdateThe HIDDEN_MAP, BACKUP_MAP
PaintSpot
lstStates.Selected((MapStateClicked())) = False
PaintShownMapFromList
End Sub
Private Sub PaintShownMapFromList()
Dim i%
UpdateThe HIDDEN_MAP, BACKUP_MAP
For i = 0 To lstStates.ListCount - 1
If lstStates.Selected(i) Then
Select Case i
Case 1, 51 To 54
giX = 79: giY = 247: PaintSpot
giX = 47: giY = 273: PaintSpot
giX = 41: giY = 273: PaintSpot
giX = 35: giY = 270: PaintSpot
giX = 29: giY = 268: PaintSpot
Case 7, 55
giX = 484: giY = 143: PaintSpot
giX = 479: giY = 146: PaintSpot
Case 11, 56 To 59
giX = 146: giY = 280: PaintSpot
giX = 139: giY = 274: PaintSpot
giX = 132: giY = 270: PaintSpot
giX = 124: giY = 266: PaintSpot
giX = 115: giY = 268: PaintSpot
Case 22, 60
giX = 361: giY = 86: PaintSpot
giX = 339: giY = 59: PaintSpot
Case Else
giX = giaX(i): giY = giaY(i): PaintSpot
End Select
End If
Next i
UpdateThe SHOWN_MAP, HIDDEN_MAP
picShown.Refresh
End Sub
Private Sub PaintSpot()
Dim iRet%, lStopColor&, iFillType%
lStopColor = RGB(0, 0, 0)
iFillType = 0
picHidden.FillColor = &H808080
iRet = ExtFloodFill _
(picHidden.hdc, giX, giY, lStopColor, iFillType)
End Sub
Private Sub PaintState()
Dim i%
gbMassUpdate = True
UpdateThe HIDDEN_MAP, BACKUP_MAP
PaintSpot
i = MapStateClicked()
If lstStates.MultiSelect > 0 Then
UpdateThe HIDDEN_MAP, SHOWN_MAP
End If
Select Case i
Case 1, 51 To 54
giX = 79: giY = 247: PaintSpot
giX = 47: giY = 273: PaintSpot
giX = 41: giY = 273: PaintSpot
giX = 35: giY = 270: PaintSpot
giX = 29: giY = 268: PaintSpot
Case 7, 55
giX = 484: giY = 143: PaintSpot
giX = 479: giY = 146: PaintSpot
Case 11, 56 To 59
giX = 146: giY = 280: PaintSpot
giX = 139: giY = 274: PaintSpot
giX = 132: giY = 270: PaintSpot
giX = 124: giY = 266: PaintSpot
giX = 115: giY = 268: PaintSpot
Case 22, 60
giX = 361: giY = 86: PaintSpot
giX = 339: giY = 59: PaintSpot
Case Else
giX = giaX(i): giY = giaY(i): PaintSpot
End Select
lstStates.Selected(i) = True
gbMassUpdate = False
UpdateThe SHOWN_MAP, HIDDEN_MAP
picShown.Refresh
End Sub
Private Sub picHidden_MouseDown(Button As Integer, Shift _
As Integer, x As Single, y As Single)
Dim i%, lStopColor&, iFillType%, iRet%, iLi%, iX&, iY&
iX = CInt(x)
iY = CInt(y)
giX = iX
giY = iY
Select Case GetPixel(picHidden.hdc, iX, iY)
Case LITE_GRAY
PaintState
Case DARK_GRAY
ClearState
End Select
End Sub
Private Sub picShown_MouseDown(Button As Integer, Shift _
As Integer, x As Single, y As Single)
picHidden_MouseDown Button, Shift, x, y
End Sub
Private Sub UpdateThe(iDest&, iSrc&)
Dim hDestDC&, iDestX&, iDestY&, iWidth&, iHeight&
Dim hSrcDC&, iXSrc&, iYSrc&, lRasterOp&, iRet&
Select Case iDest
Case 0: hDestDC = picShown.hdc
Case 1: hDestDC = picHidden.hdc
Case 2: hDestDC = picBackup.hdc
End Select
iDestX = 0
iDestY = 0
iWidth = picShown.ScaleWidth
iHeight = picShown.ScaleHeight
Select Case iSrc
Case 0: hSrcDC = picShown.hdc
Case 1: hSrcDC = picHidden.hdc
Case 2: hSrcDC = picBackup.hdc
End Select
iXSrc = 0
iYSrc = 0
lRasterOp = &HCC0020
iRet = BitBlt(hDestDC, iDestX, iDestY, iWidth, iHeight, hSrcDC, _
iXSrc, iYSrc, lRasterOp)
End Sub
|
|