home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 3_2004-2005.ISO / Data / Zips / HTML_Image178823912004.psc / frmMain.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2004-09-01  |  22.7 KB  |  566 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  4. Begin VB.Form frmMain 
  5.    BorderStyle     =   1  'Fixed Single
  6.    Caption         =   "Image Mapper by Michael Vainshtein"
  7.    ClientHeight    =   5100
  8.    ClientLeft      =   45
  9.    ClientTop       =   435
  10.    ClientWidth     =   7335
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   340
  15.    ScaleMode       =   3  'Pixel
  16.    ScaleWidth      =   489
  17.    StartUpPosition =   3  'Windows Default
  18.    Begin VB.CommandButton cmdSaveHTML 
  19.       Caption         =   "Save HTML"
  20.       Height          =   285
  21.       Left            =   2850
  22.       TabIndex        =   16
  23.       Top             =   4065
  24.       Width           =   1365
  25.    End
  26.    Begin VB.Frame Frame1 
  27.       Height          =   4635
  28.       Left            =   4350
  29.       TabIndex        =   15
  30.       Top             =   -45
  31.       Width           =   30
  32.    End
  33.    Begin VB.CommandButton cmdLink 
  34.       Caption         =   "Associate with hyperlink"
  35.       Height          =   285
  36.       Left            =   4440
  37.       TabIndex        =   14
  38.       Top             =   4005
  39.       Width           =   2805
  40.    End
  41.    Begin VB.CommandButton cmdPrev 
  42.       Caption         =   "Preview Page"
  43.       Height          =   285
  44.       Left            =   1477
  45.       TabIndex        =   13
  46.       Top             =   4065
  47.       Width           =   1365
  48.    End
  49.    Begin MSComDlg.CommonDialog DialogBox 
  50.       Left            =   105
  51.       Top             =   4350
  52.       _ExtentX        =   847
  53.       _ExtentY        =   847
  54.       _Version        =   393216
  55.    End
  56.    Begin VB.CommandButton cmdLoad 
  57.       Caption         =   "Load Picture..."
  58.       Height          =   285
  59.       Left            =   105
  60.       TabIndex        =   12
  61.       Top             =   4065
  62.       Width           =   1365
  63.    End
  64.    Begin VB.CommandButton cmdDeleteAllObjects 
  65.       Caption         =   "Delete All Areas"
  66.       Height          =   300
  67.       Left            =   5790
  68.       TabIndex        =   11
  69.       ToolTipText     =   "Delete all mapping shapes"
  70.       Top             =   4410
  71.       Width           =   1455
  72.    End
  73.    Begin MSComctlLib.StatusBar StatBar 
  74.       Align           =   2  'Align Bottom
  75.       Height          =   300
  76.       Left            =   0
  77.       TabIndex        =   10
  78.       Top             =   4800
  79.       Width           =   7335
  80.       _ExtentX        =   12938
  81.       _ExtentY        =   529
  82.       _Version        =   393216
  83.       BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
  84.          NumPanels       =   2
  85.          BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  86.             AutoSize        =   2
  87.          EndProperty
  88.          BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  89.             Alignment       =   2
  90.             AutoSize        =   1
  91.             Object.Width           =   10319
  92.          EndProperty
  93.       EndProperty
  94.    End
  95.    Begin VB.CommandButton cmdDeleteObj 
  96.       Caption         =   "Delete Area"
  97.       Height          =   300
  98.       Left            =   4470
  99.       TabIndex        =   9
  100.       ToolTipText     =   "Delete a mapping shape"
  101.       Top             =   4410
  102.       Width           =   1215
  103.    End
  104.    Begin VB.ListBox lstObjects 
  105.       Height          =   2205
  106.       Left            =   4440
  107.       TabIndex        =   5
  108.       Top             =   1680
  109.       Width           =   2775
  110.    End
  111.    Begin VB.Frame frmMode 
  112.       Caption         =   "Mode"
  113.       Height          =   1455
  114.       Left            =   4440
  115.       TabIndex        =   2
  116.       Top             =   120
  117.       Width           =   2655
  118.       Begin VB.CommandButton cmdFinilizePoly 
  119.          BackColor       =   &H0000FF00&
  120.          Caption         =   "Finilize Poly"
  121.          Enabled         =   0   'False
  122.          Height          =   225
  123.          Left            =   1440
  124.          MaskColor       =   &H8000000F&
  125.          Style           =   1  'Graphical
  126.          TabIndex        =   8
  127.          ToolTipText     =   "Finishes the drawind of the polygon"
  128.          Top             =   1065
  129.          Width           =   975
  130.       End
  131.       Begin VB.OptionButton optFreeHand 
  132.          Caption         =   "Polygon"
  133.          Height          =   285
  134.          Left            =   1440
  135.          Style           =   1  'Graphical
  136.          TabIndex        =   7
  137.          ToolTipText     =   "Cretes an area blocked by the polygon"
  138.          Top             =   720
  139.          Width           =   975
  140.       End
  141.       Begin VB.OptionButton optCircle 
  142.          Caption         =   "Circle"
  143.          Height          =   285
  144.          Left            =   1440
  145.          Style           =   1  'Graphical
  146.          TabIndex        =   6
  147.          ToolTipText     =   "Creates an area blocked by a circular shape"
  148.          Top             =   360
  149.          Width           =   975
  150.       End
  151.       Begin VB.OptionButton optRect 
  152.          Caption         =   "Rectangle"
  153.          Height          =   285
  154.          Left            =   240
  155.          Style           =   1  'Graphical
  156.          TabIndex        =   4
  157.          TabStop         =   0   'False
  158.          ToolTipText     =   "Creates an area blocked by a rectangular shape"
  159.          Top             =   720
  160.          Width           =   975
  161.       End
  162.       Begin VB.OptionButton optMove 
  163.          Caption         =   "Pan (move)"
  164.          Height          =   285
  165.          Left            =   240
  166.          Style           =   1  'Graphical
  167.          TabIndex        =   3
  168.          ToolTipText     =   "If you have a big image Pan it to see all of it."
  169.          Top             =   360
  170.          Value           =   -1  'True
  171.          Width           =   975
  172.       End
  173.    End
  174.    Begin VB.PictureBox picOrg 
  175.       Height          =   375
  176.       Left            =   4470
  177.       ScaleHeight     =   21
  178.       ScaleMode       =   3  'Pixel
  179.       ScaleWidth      =   61
  180.       TabIndex        =   1
  181.       Top             =   15
  182.       Visible         =   0   'False
  183.       Width           =   975
  184.    End
  185.    Begin VB.PictureBox Picture1 
  186.       AutoRedraw      =   -1  'True
  187.       DrawMode        =   6  'Mask Pen Not
  188.       DrawWidth       =   2
  189.       ForeColor       =   &H00FF00FF&
  190.       Height          =   3735
  191.       Left            =   120
  192.       ScaleHeight     =   245
  193.       ScaleMode       =   3  'Pixel
  194.       ScaleWidth      =   269
  195.       TabIndex        =   0
  196.       Top             =   240
  197.       Width           =   4095
  198.    End
  199.    Begin VB.Label Label1 
  200.       Alignment       =   2  'Center
  201.       AutoSize        =   -1  'True
  202.       BackColor       =   &H8000000C&
  203.       BorderStyle     =   1  'Fixed Single
  204.       Caption         =   "Exit"
  205.       Height          =   240
  206.       Left            =   0
  207.       TabIndex        =   17
  208.       Top             =   -15
  209.       Width           =   375
  210.    End
  211. Attribute VB_Name = "frmMain"
  212. Attribute VB_GlobalNameSpace = False
  213. Attribute VB_Creatable = False
  214. Attribute VB_PredeclaredId = True
  215. Attribute VB_Exposed = False
  216. Option Explicit
  217. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
  218. Private Type POintXY
  219.     X As Integer
  220.     Y As Integer
  221. End Type
  222. Private Type MObjct
  223.     oType As String
  224.     oCoord() As POintXY
  225.     oRadius As Integer
  226.     oDeleted As Boolean
  227.     oLink As String
  228. End Type
  229. Dim FileName, ApPath As String
  230. Dim CurrentObject
  231. Dim XDrag, YDrag, OldY, OldX
  232. Dim Dragging, RectDrag, CircleDrag, FreeHandDrag As Boolean
  233. Dim MapObject() As MObjct
  234. Dim FreeHandIndex As Integer
  235. Private Sub cmdDeleteAllObjects_Click()
  236.     Dim I
  237.     For I = 0 To UBound(MapObject)
  238.         If MapObject(I).oDeleted = True Then GoTo DelOK
  239.     Next
  240.     Exit Sub
  241. DelOK:
  242.     If MsgBox("Delete all mapping objects?", vbYesNo + vbQuestion, "Delete All Mapping Objects") Then
  243.         For I = 0 To UBound(MapObject)
  244.             MapObject(I).oDeleted = True
  245.         Next
  246.         DrawPic 0, 0
  247.         DrawAllObjects
  248.         RefreshList
  249.     End If
  250. End Sub
  251. Private Sub cmdDeleteObj_Click()
  252.     Dim I, C
  253.     If lstObjects.ListIndex <> -1 Then
  254.         For I = 0 To UBound(MapObject)
  255.             If MapObject(I).oDeleted = False Then C = C + 1
  256.             If C = lstObjects.ListIndex + 1 Then MapObject(I).oDeleted = True
  257.         Next
  258.         lstObjects.RemoveItem lstObjects.ListIndex
  259.         DrawPic 0, 0
  260.         DrawAllObjects
  261.     Else: MsgBox "No obejcts selected or no objects exist.", vbExclamation
  262.     End If
  263. End Sub
  264. Private Sub cmdFinilizePoly_Click()
  265.     Dim I
  266.     ReDim Preserve MapObject(CurrentObject).oCoord(FreeHandIndex)
  267.     MapObject(CurrentObject).oCoord(FreeHandIndex).X = MapObject(CurrentObject).oCoord(0).X
  268.     MapObject(CurrentObject).oCoord(FreeHandIndex).Y = MapObject(CurrentObject).oCoord(0).Y
  269.     optMove.Enabled = True: optCircle.Enabled = True: optRect.Enabled = True: cmdDeleteObj.Enabled = True: lstObjects.Enabled = True
  270.     FreeHandDrag = False
  271.     DrawPic 0, 0
  272.     DrawAllObjects OldX, OldY
  273.     RefreshList
  274.     FreeHandIndex = 0
  275.     CurrentObject = CurrentObject + 1
  276.     cmdFinilizePoly.Enabled = False
  277.     Description ""
  278. End Sub
  279. Private Sub cmdFinilizePoly_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  280.     Description "Connects the first and last line of the polygon and ends the polygon drawing"
  281. End Sub
  282. Private Sub cmdLink_Click()
  283.     Dim I, C
  284.     If lstObjects.ListIndex <> -1 Then
  285.         For I = 0 To UBound(MapObject)
  286.             If MapObject(I).oDeleted = False Then C = C + 1
  287.             If C = lstObjects.ListIndex + 1 Then
  288.                 MapObject(I).oLink = InputBox("What is the link that should be associated with this image area?", "Hyperlink destination", "http://www.")
  289.                 Exit For
  290.             End If
  291.         Next
  292.     End If
  293. End Sub
  294. Private Sub cmdPrev_Click()
  295.     On Error Resume Next
  296.     Kill ApPath & "Test.html"
  297.     Open ApPath & "Test.html" For Binary As #1
  298.         Put #1, , MakeHTML
  299.     Close #1
  300.     ShellFile ApPath & "Test.html"
  301. End Sub
  302. Private Sub cmdLoad_Click()
  303.     On Error Resume Next
  304.     DialogBox.Filter = "All pictures|*.jpg;*.gif;*.jpeg;*.bmp|All Files|*.*"
  305.     DialogBox.ShowOpen
  306.     If DialogBox.FileName <> "" Then
  307.         picOrg.Picture = LoadPicture(DialogBox.FileName)
  308.         FileName = DialogBox.FileName
  309.         cmdDeleteAllObjects_Click
  310.         DrawPic 0, 0
  311.     End If
  312. End Sub
  313. Private Sub cmdSaveHTML_Click()
  314.     On Error Resume Next
  315.     DialogBox.Filter = "HTML Files|*.html;*.htm"
  316.     DialogBox.ShowSave
  317.     If DialogBox.FileName <> "" Then
  318.         Open DialogBox.FileName For Binary As #1
  319.             Put #1, , MakeHTML
  320.         Close #1
  321.     End If
  322. End Sub
  323. Private Sub Form_Load()
  324.     ApPath = App.path & "\"
  325.     If Len(App.path) = 3 Then ApPath = App.path
  326.     DialogBox.FileName = ApPath & "ME.gif"
  327.     FileName = ApPath & "ME.gif"
  328.     picOrg.Picture = LoadPicture(ApPath & "ME.gif")
  329.     Picture1.PaintPicture picOrg.Picture, 0, 0
  330.     CurrentObject = 0
  331.     ReDim MapObject(0)
  332. End Sub
  333. Private Sub Form_Unload(Cancel As Integer)
  334.     On Error Resume Next
  335.     Kill "D:\VB\Image Mapper\Test.html"
  336. End Sub
  337. Private Sub Label1_Click()
  338.     Form_Unload (0)
  339.     End
  340. End Sub
  341. Private Sub optCircle_Click()
  342.     Picture1.MousePointer = 0
  343.     Description "Click on the Picture Box to place the center and drag to change the radius"
  344. End Sub
  345. Private Sub optFreeHand_Click()
  346.     Picture1.MousePointer = 0
  347.     Description "Click on the Picture Box to create the polygon's corners. Click Finilize Polygon to finish"
  348. End Sub
  349. Private Sub optMove_Click()
  350.     Picture1.MousePointer = 15
  351.     Description "Click on the picture and drag it to change position"
  352. End Sub
  353. Private Sub optRect_Click()
  354.     Picture1.MousePointer = 0
  355.     Description "Click and drag on the picture box to create a rectangle area"
  356. End Sub
  357. Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  358.     If Button = 1 Then
  359.         Dim I
  360.         If optMove = True Then
  361.             Dragging = True
  362.             XDrag = X
  363.             YDrag = Y
  364.             Picture1.MousePointer = 15
  365.         End If
  366.         If optRect = True Then
  367.             RectDrag = True
  368.             ReDim Preserve MapObject(CurrentObject)
  369.             ReDim Preserve MapObject(CurrentObject).oCoord(1)
  370.             MapObject(CurrentObject).oCoord(0).X = X - OldX
  371.             MapObject(CurrentObject).oCoord(0).Y = Y - OldY
  372.             MapObject(CurrentObject).oDeleted = False
  373.             MapObject(CurrentObject).oType = "rect"
  374.         End If
  375.         If optCircle Then
  376.             ReDim Preserve MapObject(CurrentObject)
  377.             ReDim Preserve MapObject(CurrentObject).oCoord(1)
  378.             MapObject(CurrentObject).oCoord(0).X = X - OldX
  379.             MapObject(CurrentObject).oCoord(0).Y = Y - OldY
  380.             MapObject(CurrentObject).oType = "circle"
  381.             MapObject(CurrentObject).oDeleted = False
  382.             CircleDrag = True
  383.         End If
  384.         If optFreeHand Then
  385.             ReDim Preserve MapObject(CurrentObject)
  386.             ReDim Preserve MapObject(CurrentObject).oCoord(FreeHandIndex)
  387.             MapObject(CurrentObject).oDeleted = False
  388.             MapObject(CurrentObject).oCoord(FreeHandIndex).X = X - OldX
  389.             MapObject(CurrentObject).oCoord(FreeHandIndex).Y = Y - OldY
  390.             MapObject(CurrentObject).oType = "poly"
  391.             FreeHandDrag = True
  392.             FreeHandIndex = FreeHandIndex + 1
  393.             DrawPic 0, 0
  394.             DrawAllObjects OldX, OldY
  395.             For I = 0 To UBound(MapObject(CurrentObject).oCoord) - 1
  396.                 Picture1.Line (MapObject(CurrentObject).oCoord(I).X + OldX, MapObject(CurrentObject).oCoord(I).Y + OldY)-(MapObject(CurrentObject).oCoord(I + 1).X + OldX, MapObject(CurrentObject).oCoord(I + 1).Y + OldY)
  397.             Next
  398.             RefreshList
  399.             
  400.             If FreeHandIndex >= 3 Then cmdFinilizePoly.Enabled = True
  401.             optMove.Enabled = False: optCircle.Enabled = False: optRect.Enabled = False: cmdDeleteObj.Enabled = False: lstObjects.Enabled = False
  402.         End If
  403.     ElseIf CircleDrag = True Or RectDrag = True Or FreeHandDrag = True Then
  404.         CircleDrag = False: RectDrag = False: FreeHandDrag = False: FreeHandIndex = 0: cmdFinilizePoly.Enabled = False
  405.         optMove.Enabled = True: optCircle.Enabled = True: optRect.Enabled = True: cmdDeleteObj.Enabled = True: lstObjects.Enabled = True
  406.         MapObject(UBound(MapObject)).oDeleted = True
  407.         CurrentObject = CurrentObject + 1
  408.         RefreshList
  409.         DrawPic 0, 0
  410.         DrawAllObjects
  411.     End If
  412.     Description "Press right mouse button to cancel current operation"
  413. End Sub
  414. Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  415.     Dim TmpX, TmpY
  416.     Dim I
  417.     If Dragging = True Then
  418.         DrawPic X, Y
  419.         DrawAllObjects OldX + X - XDrag, OldY + Y - YDrag
  420.     End If
  421.     If RectDrag = True Then
  422.         DrawPic 0, 0
  423.         Picture1.Line (OldX + MapObject(CurrentObject).oCoord(0).X, OldY + MapObject(CurrentObject).oCoord(0).Y)-(OldX + MapObject(CurrentObject).oCoord(0).X, Y)
  424.         Picture1.Line (OldX + MapObject(CurrentObject).oCoord(0).X, OldY + MapObject(CurrentObject).oCoord(0).Y)-(X, OldY + MapObject(CurrentObject).oCoord(0).Y)
  425.         Picture1.Line (X, OldY + MapObject(CurrentObject).oCoord(0).Y)-(X, Y)
  426.         Picture1.Line (OldX + MapObject(CurrentObject).oCoord(0).X, Y)-(X, Y)
  427.         DrawAllObjects OldX, OldY
  428.     End If
  429.     If CircleDrag = True Then
  430.         DrawPic 0, 0
  431.         DrawAllObjects OldX, OldY
  432.         Picture1.Circle (MapObject(CurrentObject).oCoord(0).X + OldX, MapObject(CurrentObject).oCoord(0).Y + OldY), Abs(MapObject(CurrentObject).oCoord(0).X + OldX - X)
  433.     End If
  434.     If FreeHandDrag = True And FreeHandIndex > 0 Then
  435.         DrawPic 0, 0
  436.         DrawAllObjects OldX, OldY
  437.         For I = 0 To UBound(MapObject(CurrentObject).oCoord) - 1
  438.             Picture1.Line (MapObject(CurrentObject).oCoord(I).X + OldX, MapObject(CurrentObject).oCoord(I).Y + OldY)-(MapObject(CurrentObject).oCoord(I + 1).X + OldX, MapObject(CurrentObject).oCoord(I + 1).Y + OldY)
  439.         Next
  440.         Picture1.Line (MapObject(CurrentObject).oCoord(FreeHandIndex - 1).X + OldX, MapObject(CurrentObject).oCoord(FreeHandIndex - 1).Y + OldY)-(X, Y)
  441.     End If
  442.     StatBar.Panels(StatBar.Panels.Count).Text = "X: " & X - OldX & " Y: " & Y - OldY
  443. End Sub
  444. Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  445.     If Button = 1 Then
  446.         If optMove = True Then
  447.             Dragging = False
  448.             OldX = OldX + X - XDrag
  449.             OldY = OldY + Y - YDrag
  450.             XDrag = 0
  451.             YDrag = 0
  452.             Picture1.MousePointer = 0
  453.         End If
  454.         If optRect = True And RectDrag = True Then
  455.             RectDrag = False
  456.             MapObject(CurrentObject).oCoord(1).X = X - OldX
  457.             MapObject(CurrentObject).oCoord(1).Y = Y - OldY
  458.             CurrentObject = CurrentObject + 1
  459.             RefreshList
  460.             DrawPic 0, 0
  461.             DrawAllObjects OldX, OldY
  462.         End If
  463.         If optCircle = True And CircleDrag = True Then
  464.             CircleDrag = False
  465.             MapObject(CurrentObject).oRadius = Abs(MapObject(CurrentObject).oCoord(0).X - X + OldX)
  466.             DrawPic 0, 0
  467.             DrawAllObjects OldX, OldY
  468.             CurrentObject = CurrentObject + 1
  469.             RefreshList
  470.         End If
  471.     End If
  472. End Sub
  473. Public Function DrawPic(X, Y)
  474.     Picture1.Cls
  475.     Picture1.PaintPicture picOrg.Picture, OldX + (X - XDrag), OldY + (Y - YDrag)
  476.     Picture1.CurrentX = OldX + (X - XDrag) - TextWidth("0,0")
  477.     Picture1.CurrentY = OldY + (Y - YDrag) - TextHeight("0,0")
  478.     Picture1.Print "0,0"
  479. End Function
  480. Public Sub RefreshList()
  481.     Dim I, k, S
  482.     lstObjects.Clear
  483.     For I = 0 To UBound(MapObject)
  484.         S = ""
  485.         If MapObject(I).oDeleted = False Then
  486.             Select Case MapObject(I).oType
  487.                 Case "rect": lstObjects.AddItem "Rectangle (" & MapObject(I).oCoord(0).X & ", " & MapObject(I).oCoord(0).Y & "); (" & MapObject(I).oCoord(1).X & "," & MapObject(I).oCoord(1).Y & ")"
  488.                 Case "circle": lstObjects.AddItem "Circle (" & MapObject(I).oCoord(0).X & ", " & MapObject(I).oCoord(0).Y & "); Radius=" & MapObject(I).oRadius
  489.                 Case "poly":
  490.                     For k = 0 To UBound(MapObject(I).oCoord)
  491.                         S = S & "(" & MapObject(I).oCoord(k).X & ", " & MapObject(I).oCoord(k).Y & ");"
  492.                     Next
  493.                     lstObjects.AddItem "Polygon " & S
  494.             End Select
  495.         End If
  496.     Next
  497.     lstObjects.ListIndex = lstObjects.ListCount - 1
  498. End Sub
  499. Public Sub DrawAllObjects(Optional X = 0, Optional Y = 0)
  500.     Dim I
  501.     For I = 0 To UBound(MapObject)
  502.         If MapObject(I).oDeleted = False Then
  503.             Select Case MapObject(I).oType
  504.                 Case "rect":
  505.                     If RectDrag <> True Or I <> UBound(MapObject) Then
  506.                         Picture1.Line (X + MapObject(I).oCoord(0).X, Y + MapObject(I).oCoord(0).Y)-(X + MapObject(I).oCoord(0).X, Y + MapObject(I).oCoord(1).Y)
  507.                         Picture1.Line (X + MapObject(I).oCoord(0).X, Y + MapObject(I).oCoord(0).Y)-(X + MapObject(I).oCoord(1).X, Y + MapObject(I).oCoord(0).Y)
  508.                         Picture1.Line (X + MapObject(I).oCoord(1).X, Y + MapObject(I).oCoord(0).Y)-(X + MapObject(I).oCoord(1).X, Y + MapObject(I).oCoord(1).Y)
  509.                         Picture1.Line (X + MapObject(I).oCoord(0).X, Y + MapObject(I).oCoord(1).Y)-(X + MapObject(I).oCoord(1).X, Y + MapObject(I).oCoord(1).Y)
  510.                     End If
  511.                 Case "circle"
  512.                     If CircleDrag <> True Or I <> UBound(MapObject) Then
  513.                         Picture1.Circle (X + MapObject(I).oCoord(0).X, Y + MapObject(I).oCoord(0).Y), MapObject(I).oRadius
  514.                     End If
  515.                 Case "poly"
  516.                     If FreeHandDrag <> True Or I <> UBound(MapObject) Then
  517.                         Dim k
  518.                         For k = 0 To UBound(MapObject(I).oCoord) - 1
  519.                             Picture1.Line (MapObject(I).oCoord(k).X + X, MapObject(I).oCoord(k).Y + Y)-(MapObject(I).oCoord(k + 1).X + X, MapObject(I).oCoord(k + 1).Y + Y)
  520.                         Next
  521.                     End If
  522.             End Select
  523.         End If
  524.     Next
  525. End Sub
  526. Public Sub Description(Optional txt = "")
  527.     If txt <> "" Then
  528.         StatBar.Panels(1).AutoSize = sbrContents
  529.         StatBar.Panels(1).Text = txt & ". "
  530.     Else: StatBar.Panels(1).AutoSize = sbrSpring
  531.     End If
  532. End Sub
  533. Public Function MakeHTML() As String
  534.     Dim S As String
  535.     Dim I, k
  536.     S = "Right-Click ->View Source.. Copy and paste into your own page<BR>Note that only the ares that you've chosen in the Image Mapper link to their destantion and not the whole rectangular image as usual. (dah, this is the whole purpose of the programme)<BR>" & vbNewLine & "<MAP name=myMap>"
  537.     For I = 0 To UBound(MapObject)
  538.         If MapObject(I).oDeleted = False Then
  539.             Select Case MapObject(I).oType
  540.                 Case "circle"
  541.                     S = S & vbNewLine & "     <AREA shape=""circle"" COORDS="""
  542.                     S = S & Str(MapObject(I).oCoord(0).X) & "," & Str(MapObject(I).oCoord(0).Y) & "," & Str(MapObject(I).oRadius)
  543.                 Case "rect"
  544.                     S = S & vbNewLine & "     <AREA shape=""rect"" COORDS="""
  545.                     S = S & Str(MapObject(I).oCoord(0).X) & "," & Str(MapObject(I).oCoord(0).Y) & "," & Str(MapObject(I).oCoord(1).X) & "," & Str(MapObject(I).oCoord(1).Y) & """"
  546.                 Case "poly"
  547.                     S = S & vbNewLine & "     <AREA shape=""poly"" COORDS="""
  548.                     For k = 0 To UBound(MapObject(I).oCoord)
  549.                         S = S & Str(MapObject(I).oCoord(k).X) & "," & Str(MapObject(I).oCoord(k).Y)
  550.                         If k <> UBound(MapObject(I).oCoord) Then S = S & ","
  551.                     Next
  552.             End Select
  553.             If MapObject(I).oType <> "" Then
  554.                 S = S & """ href=""" & MapObject(I).oLink & """>"
  555.             Else: S = "<MAP name=myMap>"
  556.             End If
  557.         End If
  558.     Next
  559.     S = S & vbNewLine & "</MAP>"
  560.     S = S & vbNewLine & vbNewLine & "<IMG src=""" & FileName & """ USEMAP=""#myMap"">"
  561.     MakeHTML = S
  562. End Function
  563. Public Function ShellFile(path As String)
  564. ShellFile = ShellExecute(Me.hwnd, "open", path, "", "", 1)
  565. End Function
  566.