'Used with StartX,StartY these coordinates determine
'a new rectangular region
Dim LastX, LastY As Integer
'Determines if the user is about to draw a new region
Dim NewRegion As Boolean
'An integer used in a little animation effect
'that makes sure that the regions already drawn
'show up well on pictures of all colors
Dim Col As Integer
Private Sub mnuExit_Click()
For Each frm In Forms
Unload frm
End Sub
Private Sub mnuGetHTML_Click()
'If the user hasn't drawn any regions,then there's
'no HTML to generate
If NofRegions = 0 Then Exit Sub
'Input a name for the <MAP NAME= tag
mapname = InputBox("Give a name for the image map: " & vbCrLf & "(for the <MAP NAME=" & Chr(34) & "..." & Chr(34) & "> tag)", "Image map name")
If Trim(mapname) = "" Then Beep: Exit Sub
'Generate the HTML code
HTML = "<!-- Image map HTML code created with I m a g e M a p M a k e r by Theodore Kandiliotis , ionikh@hol.gr , http://www.geocities.com/SiliconValley/Network/5045 -->" & vbCrLf & _
HTML = HTML & "</MAP>" & vbCrLf & "<!-- End of Image map HTML code created with I m a g e M a p M a k e r -->"
'Show the HTML code
frmHTML.txtHTML = HTML
frmHTML.txtHTML.Visible = True
frmHTML.Show vbModal
End Sub
Private Sub mnuHelp_Click()
'Show the help file
ChDir App.Path
Shell "NOTEPAD Read_Me.TXT", vbNormalFocus
End Sub
Private Sub mnuNewImageMap_Click()
'Ininialize everything for a new image map
NofRegions = 0
'Hide the scrollbars
vsb1.Visible = False
hsb1.Visible = False
On Error GoTo ErrorHandler
'Allow the user to select an image
dlgOpen.ShowOpen
picImage.Cls
picImage.Picture = LoadPicture(dlgOpen.filename)
'Check if the scrollbars should be shown
If picImage.Width > picContainer.Width Then
hsb1.Max = picImage.Width
hsb1.Visible = True
End If
If picImage.Height > picContainer.Height Then
vsb1.Max = picImage.Height
vsb1.Visible = True
End If
'Show the image so that the user can start
'drawing the regions
picImage.Visible = True
ErrorHandler:
Exit Sub
End Sub
Private Sub mnuNewRegion_Click()
'Initialize things for a new clickable region
'on the current image map
NewRegion = True
'Show the scrolling message
lblScroller.Caption = "Click on the spot where you want the upper-left edge of the region to be . Then move the mouse and click on the lower-right edge."
picScroller.Width = lblScroller.Width
picScroller.Left = picContainScroller.ScaleWidth
Timer1.Enabled = True
picContainScroller.Visible = True
End Sub
Private Sub picImage_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'If the user is currently drawing a new region...
Select Case DrawRegion
Case True
If NewRegion = False Then Exit Sub
'...draw a rectangular that moves along with
'the mouse pointer...
picImage.PaintPicture picImage.Picture, 0, 0
picImage.Line (StartX, StartY)-(X, Y), , B
'...and show the coordinates in a the label on the