home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / pagede1a / imagemap.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-08-31  |  6.1 KB  |  209 lines

  1. VERSION 5.00
  2. Begin VB.Form Form8 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "New image map"
  5.    ClientHeight    =   4605
  6.    ClientLeft      =   45
  7.    ClientTop       =   285
  8.    ClientWidth     =   5175
  9.    LinkTopic       =   "Form8"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   4605
  13.    ScaleWidth      =   5175
  14.    ShowInTaskbar   =   0   'False
  15.    StartUpPosition =   2  'CenterScreen
  16.    Begin VB.CommandButton Command1 
  17.       Caption         =   "Ok"
  18.       Default         =   -1  'True
  19.       Height          =   255
  20.       Left            =   4080
  21.       TabIndex        =   5
  22.       Top             =   0
  23.       Width           =   1095
  24.    End
  25.    Begin VB.TextBox Text1 
  26.       Height          =   285
  27.       Left            =   840
  28.       TabIndex        =   2
  29.       Top             =   360
  30.       Width           =   4215
  31.    End
  32.    Begin VB.CommandButton Command3 
  33.       Caption         =   "Add"
  34.       Height          =   255
  35.       Left            =   1320
  36.       TabIndex        =   1
  37.       Top             =   0
  38.       Visible         =   0   'False
  39.       Width           =   1095
  40.    End
  41.    Begin VB.CommandButton Command2 
  42.       Caption         =   "Browse image"
  43.       Height          =   255
  44.       Left            =   0
  45.       TabIndex        =   7
  46.       Top             =   0
  47.       Width           =   1335
  48.    End
  49.    Begin VB.VScrollBar VScroll1 
  50.       Height          =   3495
  51.       Left            =   4920
  52.       TabIndex        =   6
  53.       Top             =   840
  54.       Width           =   255
  55.    End
  56.    Begin VB.HScrollBar HScroll1 
  57.       Height          =   255
  58.       Left            =   0
  59.       TabIndex        =   3
  60.       Top             =   4320
  61.       Width           =   4935
  62.    End
  63.    Begin VB.PictureBox Picture1 
  64.       Height          =   3495
  65.       Left            =   0
  66.       ScaleHeight     =   229
  67.       ScaleMode       =   3  'Pixel
  68.       ScaleWidth      =   325
  69.       TabIndex        =   0
  70.       Top             =   840
  71.       Width           =   4935
  72.       Begin VB.PictureBox picview 
  73.          AutoSize        =   -1  'True
  74.          BackColor       =   &H00C0C0C0&
  75.          BorderStyle     =   0  'None
  76.          Height          =   375
  77.          Left            =   0
  78.          ScaleHeight     =   25
  79.          ScaleMode       =   3  'Pixel
  80.          ScaleWidth      =   33
  81.          TabIndex        =   4
  82.          Top             =   0
  83.          Width           =   495
  84.       End
  85.    End
  86.    Begin VB.Label Label1 
  87.       AutoSize        =   -1  'True
  88.       BackStyle       =   0  'Transparent
  89.       Caption         =   "Page url:"
  90.       Height          =   195
  91.       Left            =   120
  92.       TabIndex        =   8
  93.       Top             =   360
  94.       Width           =   630
  95.    End
  96. Attribute VB_Name = "Form8"
  97. Attribute VB_GlobalNameSpace = False
  98. Attribute VB_Creatable = False
  99. Attribute VB_PredeclaredId = True
  100. Attribute VB_Exposed = False
  101. Dim start As Boolean
  102. Dim selectr As Boolean
  103. Dim x1 As Single
  104. Dim y1 As Single
  105. Dim x2 As Single
  106. Dim y2 As Single
  107. Dim filen As String
  108. Dim html As String
  109. Dim fcode As String
  110. Private Sub Command1_Click()
  111. On Error Resume Next
  112. fcode = "<MAP NAME='map'>" & html & "<IMG SRC='" & filen & "' USEMAP='#map'></MAP>"
  113. Form6.Text1.SelText = fcode
  114. Unload Me
  115. End Sub
  116. Private Sub Command2_Click()
  117. On Error GoTo er
  118. MDI.CommonDialog1.Filter = "Gif images(*.gif)|*.gif|Jpeg inmages(*.jpg)|*.jpg|Windows bitmap(*.bmp)|*.bmp|Windows Metafile(*.wmf)|*.wmf|Icons(*.ico)|*.ico|Cursers(*.cur)|*.cur|"
  119. MDI.CommonDialog1.ShowOpen
  120. picview.Picture = LoadPicture(MDI.CommonDialog1.filename)
  121. filen = MDI.CommonDialog1.filename
  122. If picview.Width > Picture1.ScaleWidth Then
  123. HScroll1.Visible = True
  124. HScroll1.Max = picview.Width - Picture1.ScaleWidth
  125. HScroll1.Visible = False
  126. End If
  127. If picview.Height > Picture1.ScaleHeight Then
  128. VScroll1.Visible = True
  129. VScroll1.Max = picview.Height - Picture1.ScaleHeight
  130. VScroll1.Visible = False
  131. End If
  132. Exit Sub
  133. If Err.Number <> 32755 Then
  134. MsgBox Err.Description
  135. End If
  136. End Sub
  137. Private Sub Command3_Click()
  138. On Error Resume Next
  139. If Text1.Text <> "" Then
  140. html = html + "<AREA SHAPE='RECT' COORDS='" & x1 & "," & y1 & "," & x2 & "," & y2 & "' HREF='" & Text1.Text & "'>"
  141. Command3.Visible = False
  142. Text1.Text = ""
  143. MsgBox "You must enter the page url"
  144. End If
  145. End Sub
  146. Private Sub Form_Load()
  147. start = True
  148. selectr = False
  149. On Error GoTo er
  150. MDI.CommonDialog1.Filter = "Gif images(*.gif)|*.gif|Jpeg inmages(*.jpg)|*.jpg|Windows bitmap(*.bmp)|*.bmp|Windows Metafile(*.wmf)|*.wmf|Icons(*.ico)|*.ico|Cursers(*.cur)|*.cur|"
  151. MDI.CommonDialog1.ShowOpen
  152. picview.Picture = LoadPicture(MDI.CommonDialog1.filename)
  153. filen = MDI.CommonDialog1.filename
  154. If picview.Width > Picture1.ScaleWidth Then
  155. HScroll1.Visible = True
  156. HScroll1.Max = picview.Width - Picture1.ScaleWidth
  157. HScroll1.Visible = False
  158. End If
  159. If picview.Height > Picture1.ScaleHeight Then
  160. VScroll1.Visible = True
  161. VScroll1.Max = picview.Height - Picture1.ScaleHeight
  162. VScroll1.Visible = False
  163. End If
  164. Exit Sub
  165. If Err.Number <> 32755 Then
  166. MsgBox Err.Description
  167. End If
  168. End Sub
  169. Private Sub HScroll1_Change()
  170. HScroll1_Scroll
  171. End Sub
  172. Private Sub HScroll1_Scroll()
  173. On Error Resume Next
  174. picview.Left = -HScroll1.Value
  175. End Sub
  176. Private Sub picview_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  177. If start = True Then
  178. Command3.Visible = False
  179. x1 = X
  180. y1 = Y
  181. start = False
  182. selectr = True
  183. End If
  184. End Sub
  185. Private Sub picview_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  186. If selectr = True Then
  187. picview.Cls
  188. Rectangle picview.hdc, x1, y1, X, Y
  189. End If
  190. End Sub
  191. Private Sub picview_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  192. If selectr = True Then
  193. Command3.Visible = True
  194. picview.Cls
  195. Rectangle picview.hdc, x1, y1, X, Y
  196. y2 = Y
  197. x2 = X
  198. start = True
  199. selectr = False
  200. End If
  201. End Sub
  202. Private Sub VScroll1_Change()
  203. VScroll1_Scroll
  204. End Sub
  205. Private Sub VScroll1_Scroll()
  206. On Error Resume Next
  207. picview.Top = -VScroll1.Value
  208. End Sub
  209.