home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / fastview / frmfastv.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-01-16  |  21.2 KB  |  678 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
  3. Begin VB.Form frmFastView 
  4.    AutoRedraw      =   -1  'True
  5.    BorderStyle     =   1  'Fixed Single
  6.    Caption         =   "FastView32"
  7.    ClientHeight    =   3120
  8.    ClientLeft      =   1350
  9.    ClientTop       =   2115
  10.    ClientWidth     =   4515
  11.    Icon            =   "frmFastView.frx":0000
  12.    LinkTopic       =   "Form1"
  13.    LockControls    =   -1  'True
  14.    MaxButton       =   0   'False
  15.    ScaleHeight     =   3120
  16.    ScaleWidth      =   4515
  17.    Begin VB.HScrollBar wScroll 
  18.       Height          =   240
  19.       Left            =   0
  20.       SmallChange     =   100
  21.       TabIndex        =   4
  22.       TabStop         =   0   'False
  23.       Top             =   2445
  24.       Width           =   4290
  25.    End
  26.    Begin VB.VScrollBar hScroll 
  27.       Height          =   2460
  28.       Left            =   4275
  29.       SmallChange     =   100
  30.       TabIndex        =   3
  31.       TabStop         =   0   'False
  32.       Top             =   0
  33.       Width           =   240
  34.    End
  35.    Begin VB.Timer tmrOnTop 
  36.       Enabled         =   0   'False
  37.       Interval        =   1
  38.       Left            =   3120
  39.       Top             =   2805
  40.    End
  41.    Begin VB.Timer FormPaint 
  42.       Enabled         =   0   'False
  43.       Interval        =   1
  44.       Left            =   3600
  45.       Top             =   2805
  46.    End
  47.    Begin VB.TextBox txtFilename 
  48.       Height          =   240
  49.       Left            =   2385
  50.       TabIndex        =   2
  51.       Top             =   2790
  52.       Visible         =   0   'False
  53.       Width           =   105
  54.    End
  55.    Begin MSComDlg.CommonDialog Dialog1 
  56.       Left            =   0
  57.       Top             =   2625
  58.       _ExtentX        =   847
  59.       _ExtentY        =   847
  60.       _Version        =   327681
  61.    End
  62.    Begin VB.PictureBox picGet 
  63.       Height          =   405
  64.       Left            =   600
  65.       ScaleHeight     =   23
  66.       ScaleMode       =   3  'Pixel
  67.       ScaleWidth      =   27
  68.       TabIndex        =   1
  69.       Top             =   2700
  70.       Visible         =   0   'False
  71.       Width           =   465
  72.    End
  73.    Begin VB.PictureBox picSquare 
  74.       BorderStyle     =   0  'None
  75.       Height          =   240
  76.       Left            =   4290
  77.       ScaleHeight     =   240
  78.       ScaleWidth      =   240
  79.       TabIndex        =   0
  80.       Top             =   2460
  81.       Width           =   240
  82.    End
  83.    Begin VB.Image imgBlank 
  84.       BorderStyle     =   1  'Fixed Single
  85.       Height          =   540
  86.       Left            =   3780
  87.       Picture         =   "frmFastView.frx":0442
  88.       Top             =   2775
  89.       Visible         =   0   'False
  90.       Width           =   540
  91.    End
  92.    Begin VB.Image imgTile 
  93.       Height          =   240
  94.       Left            =   2655
  95.       Top             =   2790
  96.       Visible         =   0   'False
  97.       Width           =   300
  98.    End
  99.    Begin VB.Image picImage 
  100.       Height          =   2625
  101.       Left            =   0
  102.       Top             =   0
  103.       Width           =   4350
  104.    End
  105.    Begin VB.Menu mnuFile 
  106.       Caption         =   "&File"
  107.       Begin VB.Menu mnuOpen 
  108.          Caption         =   "&Open"
  109.          Shortcut        =   {F2}
  110.       End
  111.       Begin VB.Menu mnuSave 
  112.          Caption         =   "Save As .bmp"
  113.          Shortcut        =   {F3}
  114.       End
  115.       Begin VB.Menu mnuFSp 
  116.          Caption         =   "-"
  117.       End
  118.       Begin VB.Menu mnuFDelete 
  119.          Caption         =   "Delete"
  120.       End
  121.       Begin VB.Menu mnuFSplit 
  122.          Caption         =   "-"
  123.       End
  124.       Begin VB.Menu mnuExit 
  125.          Caption         =   "E&xit"
  126.       End
  127.    End
  128.    Begin VB.Menu mnuEdit 
  129.       Caption         =   "&Edit"
  130.       Begin VB.Menu mnuCut 
  131.          Caption         =   "C&ut"
  132.          Shortcut        =   ^X
  133.       End
  134.       Begin VB.Menu mnuCopy 
  135.          Caption         =   "&Copy"
  136.          Shortcut        =   ^C
  137.       End
  138.       Begin VB.Menu mnuPaste 
  139.          Caption         =   "&Paste"
  140.          Shortcut        =   ^V
  141.       End
  142.       Begin VB.Menu mnuDelete 
  143.          Caption         =   "&Clear Picture"
  144.          Shortcut        =   {DEL}
  145.       End
  146.       Begin VB.Menu mnuESplit 
  147.          Caption         =   "-"
  148.       End
  149.       Begin VB.Menu mnuClearClip 
  150.          Caption         =   "Cle&ar Clipboard"
  151.       End
  152.       Begin VB.Menu mnualskdfSplit 
  153.          Caption         =   "-"
  154.       End
  155.       Begin VB.Menu mnuNegative 
  156.          Caption         =   "Nega&tive (Invert Colors)"
  157.       End
  158.       Begin VB.Menu mnuIvert 
  159.          Caption         =   "-"
  160.       End
  161.       Begin VB.Menu mnuImgMap 
  162.          Caption         =   "Create Image Map"
  163.       End
  164.       Begin VB.Menu mnuImageCode 
  165.          Caption         =   "Image HTML Code"
  166.       End
  167.    End
  168.    Begin VB.Menu mnuOptions 
  169.       Caption         =   "&Options"
  170.       Begin VB.Menu mnuOnTop 
  171.          Caption         =   "Always on Top"
  172.       End
  173.       Begin VB.Menu mnuChangeBG 
  174.          Caption         =   "&Background Image/Color"
  175.          Begin VB.Menu mnuNoBG 
  176.             Caption         =   "&None"
  177.          End
  178.          Begin VB.Menu mnuBGSplit 
  179.             Caption         =   "-"
  180.          End
  181.          Begin VB.Menu mnuColor 
  182.             Caption         =   "&Color"
  183.             Begin VB.Menu mnuOther 
  184.                Caption         =   "&Custom"
  185.             End
  186.             Begin VB.Menu mnuBGCSplit 
  187.                Caption         =   "-"
  188.             End
  189.             Begin VB.Menu mnuWhite 
  190.                Caption         =   "&White"
  191.             End
  192.             Begin VB.Menu mnuBlack 
  193.                Caption         =   "&Black"
  194.             End
  195.             Begin VB.Menu mnuBlue 
  196.                Caption         =   "Bl&ue"
  197.             End
  198.             Begin VB.Menu mnuGreen 
  199.                Caption         =   "&Green"
  200.             End
  201.             Begin VB.Menu mnuRed 
  202.                Caption         =   "&Red"
  203.             End
  204.             Begin VB.Menu mnuYellow 
  205.                Caption         =   "&Yellow"
  206.             End
  207.          End
  208.          Begin VB.Menu mnuBGBrowse 
  209.             Caption         =   "&Image"
  210.          End
  211.       End
  212.    End
  213.    Begin VB.Menu mnuHelp 
  214.       Caption         =   "&Help"
  215.       Begin VB.Menu mnuAbout 
  216.          Caption         =   "&About"
  217.       End
  218.       Begin VB.Menu mnuReadme 
  219.          Caption         =   "&Readme"
  220.       End
  221.    End
  222. Attribute VB_Name = "frmFastView"
  223. Attribute VB_GlobalNameSpace = False
  224. Attribute VB_Creatable = False
  225. Attribute VB_PredeclaredId = True
  226. Attribute VB_Exposed = False
  227. '*******************************************************
  228. ' FastView32 was written mostly by Ryan Martinsen
  229. ' Image Map Maker - written by Theo Kandiliotis - ionikh@hol.gr
  230. ' I don't know who wrote the code for Inverting Colors
  231. ' If you use any of this code I would appreciate it if
  232. ' you would send me any improvements made to the code or
  233. ' interface design.
  234. ' Please use credit where due.
  235. ' E-mail: ryan@homeonthewww.com
  236. ' Web:    http://www.homeonthewww.com/ryan/
  237. '*******************************************************
  238. Private FormPic
  239. Private Declare Function InvertRect Lib "user32" (ByVal hdc As Long, lpRect As RECT) As Long
  240. Private Type RECT
  241.   Left As Long
  242.   Top As Long
  243.   Right As Long
  244.   Bottom As Long
  245. End Type
  246. Dim lrect As RECT
  247. Private Sub Form_Load()
  248. DragAcceptFiles frmFastView.hwnd, True
  249. On Error Resume Next
  250. picGet.BorderStyle = 0
  251. 'check for command line file, load if exists
  252. If Not Command = "" Then
  253. Dim cmd As String
  254. cmd = LCase$(Command)
  255.  If Right$(cmd, 4) = ".htm" Or Right$(cmd, 4) = ".css" Or Right$(cmd, 4) = ".txt" Or Right$(cmd, 4) = "html" Or Right$(cmd, 4) = ".asp" Or Right$(cmd, 4) = "shtm" Then
  256.   frmFastViewHTML.Show
  257.   frmFastViewHTML.WebBrowser1.Navigate cmd
  258.   Me.Hide
  259.  Else
  260.   Set picImage.Picture = LoadPicture(cmd)
  261.   Me.Caption = "FastView32 - " & ExtractName(cmd) & " (" & picGet.ScaleWidth & " x " & picGet.ScaleHeight & ")"
  262.  End If
  263. End If
  264.  Me.Width = picImage.Width + 95
  265. If hScroll.Visible = True Then Me.Width = Me.Width + hScroll.Width
  266.  Me.Height = picImage.Height + 665
  267. If wScroll.Visible = True Then Me.Height = Me.Height + hScroll.Width
  268. picGet.Height = picImage.Height
  269. picGet.Width = picImage.Width
  270. TWidth = Screen.Width \ Screen.TwipsPerPixelX
  271. THeight = Screen.Height \ Screen.TwipsPerPixelY
  272. ScreenRes = TWidth & "x" & THeight
  273. Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
  274. picImage.ToolTipText = Dialog1.filename
  275. FormPic = GetSetting("Take a Hike Software", "FastView32", "Picture", Nothing)
  276. If FormPic = "Nothing" Then
  277.  Me.BackColor = GetSetting("Take a Hike Software", "FastView32", "BackColor", &H8000000F)
  278.  imgTile.Picture = LoadPicture(FormPic)
  279.  Form_Paint
  280. End If
  281. frmHidden.WindowState = vbMinimized
  282. frmHidden.Show
  283. frmHidden.Hide
  284. If frmFastViewHTML.Visible = False Then
  285.  Me.Show
  286.  Me.Refresh
  287. End If
  288. Exit Sub
  289. End Sub
  290. Private Sub Form_Paint()
  291. If FormPic = "Nothing" Then Exit Sub
  292.     Dim x As Integer, y As Integer
  293.     Dim ImgWidth As Integer
  294.     Dim ImgHeight As Integer
  295.     Dim FrmWidth As Integer
  296.     Dim FrmHeight As Integer
  297.    'use Image1 or picImage, as appropriate.
  298.    'use one of the following PaintPicture methods:
  299.     ImgWidth = imgTile.Width
  300.     ImgHeight = imgTile.Height
  301.     FrmWidth = frmFastView.Width
  302.     FrmHeight = frmFastView.Height
  303.    'tile entire form (Method 1)
  304.     For x = 0 To FrmWidth Step ImgWidth
  305.        For y = 0 To FrmHeight Step ImgHeight
  306.           PaintPicture imgTile, x, y
  307.        Next y
  308.     Next x
  309.    'tile left side (Method 2)
  310.    'For Y = 0 To FrmHeight Step ImgHeight
  311.    '   PaintPicture Image1, 0, Y
  312.    'Next Y
  313. End Sub
  314. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  315. DragAcceptFiles frmFastView.hwnd, False
  316. SaveSetting "Take a Hike Software", "FastView32", "BackColor", Me.BackColor
  317. SaveSetting "Take a Hike Software", "FastView32", "Picture", FormPic
  318. End Sub
  319. Private Sub Form_Resize()
  320. On Error Resume Next
  321. If Me.Width <= 4635 Then Me.Width = 4635
  322. If ScreenRes = "640x480" Then
  323. ' If too wide
  324.  If Width > 9170 Then ' 9170
  325.   Width = 9170
  326.   wScroll.Visible = True
  327.  ElseIf Width < 9170 Then
  328.   wScroll.Visible = False
  329.  End If
  330. ' If too high
  331.  If Height > 6645 Then '6645
  332.   Height = 6645
  333.   hScroll.Visible = True
  334.  Else
  335.   hScroll.Visible = False
  336.  End If
  337. ElseIf ScreenRes = "800x600" Then
  338. ' If too wide
  339.  If Width > 11500 Then ' 11500
  340.   Width = 11500
  341.   wScroll.Visible = True
  342.  ElseIf Width < 11500 Then
  343.   wScroll.Visible = False
  344.  End If
  345. ' If too high
  346.  If Height > 8600 Then '8600
  347.   Height = 8600
  348.   hScroll.Visible = True
  349.  Else
  350.   hScroll.Visible = False
  351.  End If
  352. ElseIf ScreenRes = "1024x768" Then
  353. End If ' End Too Big Checking
  354. wScroll.Width = Me.ScaleWidth - hScroll.Width
  355. wScroll.Move 0, Me.ScaleHeight - 240
  356. hScroll.Height = Me.ScaleHeight - hScroll.Width
  357. hScroll.Move Me.ScaleWidth - 240
  358. If hScroll.Visible = False Then wScroll.Width = wScroll.Width + hScroll.Width
  359. If wScroll.Visible = False Then hScroll.Height = hScroll.Height + hScroll.Width
  360. picSquare.Move Me.ScaleWidth - 235, Me.ScaleHeight - 235
  361. VDiff = Me.ScaleHeight - picImage.Height - hScroll.Width 'gets the scale height of the scrolling picture
  362. hScroll.Max = Abs(VDiff) 'set the vertical scroll bar to its maximum value
  363. hScroll.LargeChange = hScroll.Max \ 10 'set the vertical large change property
  364. HDiff = Me.ScaleWidth - picImage.Width - wScroll.Height
  365. wScroll.Max = Abs(HDiff) 'set the horizontal scroll bar to its maximum value
  366. wScroll.LargeChange = wScroll.Max \ 10 'set the horizontal large change property
  367. ' If both scrollbars aren't visible then get rid of the little square image
  368.  If hScroll.Visible = True Or wScroll.Visible = True Then
  369.   picSquare.Visible = True
  370.  Else
  371.   picSquare.Visible = False
  372.  End If
  373. End Sub
  374. Private Sub Form_Unload(Cancel As Integer)
  375. End Sub
  376. Private Sub FormPaint_Timer()
  377. Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
  378. Form_Paint
  379. FormPaint.Enabled = False
  380. End Sub
  381. Private Sub hScroll_Change()
  382. picImage.Top = -hScroll.Value 'scroll the verticle scroll bar
  383. End Sub
  384. Private Sub mnuAbout_Click()
  385. MsgBox "FastView32 2.0 beta 2 -  Copyright 
  386.  1998 Take a Hike Software", vbInformation
  387. End Sub
  388. Private Sub mnuBGBrowse_Click()
  389. Dialog1.CancelError = True
  390. Dialog1.filename = ""
  391. On Error GoTo err1
  392. Dialog1.DialogTitle = "Open Image for Viewing"
  393. Dialog1.Flags = &H4
  394. Dialog1.Filter = "All Supported Formats|*.gif;*.jpg;*.bmp;*.dib;*.wmf|Gif Images (.gif)|*.gif|Jpeg Images (.jpg)|*.jpg|Bitmap Images (.bmp)|*.bmp|OS/2 or Windows DIB (*.dib)|*.dib|Windows Meta File (*.wmf)|*.wmf|All Files (*.*)|*.*"
  395. Dialog1.FilterIndex = 1
  396. Dialog1.ShowOpen
  397. If Not Dialog1.filename = "" Then
  398. Me.BackColor = &H8000000F
  399. imgTile.Picture = imgBlank.Picture
  400. imgTile.Picture = LoadPicture(Dialog1.filename)
  401. FormPic = Dialog1.filename
  402. Form_Paint
  403. End If
  404. Exit Sub
  405. err1:
  406. If Err = 32755 = True Then
  407. MsgBox Error, vbCritical, "Invalid Picture"
  408. End If
  409. Resume Next
  410. Exit Sub
  411. End Sub
  412. Private Sub mnuBlack_Click()
  413. imgTile.Picture = imgBlank.Picture
  414. Me.BackColor = &H0&
  415. FormPic = "Nothing"
  416. Form_Paint
  417. End Sub
  418. Private Sub mnuBlue_Click()
  419. imgTile.Picture = imgBlank.Picture
  420. Me.BackColor = &HFF0000
  421. FormPic = "Nothing"
  422. Form_Paint
  423. End Sub
  424. Private Sub mnuClearClip_Click()
  425. Clipboard.Clear
  426. End Sub
  427. Private Sub mnuCopy_Click()
  428. On Error GoTo err1
  429. Clipboard.Clear
  430. Clipboard.SetData picImage.Picture
  431. Exit Sub
  432. err1:
  433. MsgBox Error
  434. Resume Next
  435. Exit Sub
  436. End Sub
  437. Private Sub mnuCut_Click()
  438. On Error GoTo err1
  439. Clipboard.Clear
  440. Clipboard.SetData picImage.Picture
  441. Set picImage.Picture = Nothing
  442. Me.Height = 3290
  443. Me.Width = 4632
  444. Me.Caption = "FastView32"
  445. Exit Sub
  446. err1:
  447. MsgBox Error
  448. Resume Next
  449. Exit Sub
  450. End Sub
  451. Private Sub mnuDelete_Click()
  452. Set picImage.Picture = Nothing
  453. Me.Height = 3290
  454. Me.Width = 4635
  455. Me.Caption = "FastView32"
  456. End Sub
  457. Private Sub mnuEdit_Click()
  458.  If Me.Caption = "FastView32" Then
  459.   mnuCopy.Enabled = False
  460.   mnuCut.Enabled = False
  461.   mnuFDelete.Enabled = False
  462.   mnuDelete.Enabled = False
  463.   mnuImageCode.Enabled = False
  464.   mnuNegative.Enabled = False
  465.  Else
  466.   mnuCopy.Enabled = True
  467.   mnuCut.Enabled = True
  468.   mnuDelete.Enabled = True
  469.   mnuFDelete.Enabled = True
  470.   mnuImageCode.Enabled = True
  471.   mnuNegative.Enabled = True
  472.  End If
  473. End Sub
  474. Private Sub mnuExit_Click()
  475. Unload Me
  476. End Sub
  477. Private Sub mnuFDelete_Click()
  478. Dim msg
  479. msg = MsgBox("Are you sure you want to permanently delete (no recycle bin) " & Dialog1.filename & "?", vbQuestion + vbYesNo, "Are you sure?")
  480. If msg = vbYes Then
  481.  Kill Dialog1.filename
  482.  mnuDelete_Click
  483. End If
  484. End Sub
  485. Private Sub mnuFile_Click()
  486.  If Me.Caption = "FastView32" Then
  487.   mnuFDelete.Enabled = False
  488.  Else
  489.   mnuFDelete.Enabled = True
  490.  End If
  491. If Left$(Me.Caption, 24) = "FastView32 - <Clipboard>" Then mnuFDelete.Enabled = False
  492. End Sub
  493. Private Sub mnuGreen_Click()
  494. imgTile.Picture = imgBlank.Picture
  495. Me.BackColor = &H8000&
  496. FormPic = "Nothing"
  497. Form_Paint
  498. End Sub
  499. Private Sub mnuImageCode_Click()
  500. frmImgHTML.Show
  501. frmImgHTML.txtImgCode.Text = _
  502. "<img src=""" & ExtractName(frmFastView.Dialog1.filename) & """" & _
  503. " width=" & frmFastView.picGet.ScaleWidth & " height=" & _
  504. frmFastView.picGet.ScaleHeight & " border=""0""" & " alt="""">"
  505. End Sub
  506. Private Sub mnuImgMap_Click()
  507. frmImgMap.picImage.Cls
  508. frmImgMap.picImage.Picture = picImage.Picture
  509. frmImgMap.picImage.Visible = True
  510. frmImgMap.Show
  511. End Sub
  512. Private Sub mnuNegative_Click()
  513. MsgBox "doesn't work yet"
  514. '*******************************************************
  515. ' picImage is an Image control, not a PictureBox so
  516. ' inverting the colors won't work with it.
  517. ' However, picGet is a PictureBox.  So the problem is
  518. ' inverting picGet and then copying it to picImage.
  519. ' It seems that inverting the colors in the PictureBox
  520. ' doesn't actually change the image itself.  So copying
  521. ' the image to picImage just restores the image back to
  522. ' normal.  Maybe there is a better way to Invert colors?
  523. '*******************************************************
  524. Dim a As Long ' multi-use variable
  525.         With lrect 'set rect to the whole picture
  526.             .Top = 0
  527.             .Left = 0
  528.             .Bottom = picGet.Height
  529.             .Right = picGet.Width
  530.         End With
  531. a = InvertRect(picGet.hdc, lrect)
  532. End Sub
  533. Private Sub mnuNoBG_Click()
  534. imgTile.Picture = imgBlank.Picture
  535. Me.BackColor = &HFFFFFF
  536. Me.BackColor = &H8000000F
  537. FormPic = "Nothing"
  538. Form_Paint
  539. End Sub
  540. Private Sub mnuOnTop_Click()
  541. mnuOnTop.Checked = Not mnuOnTop.Checked
  542. If mnuOnTop.Checked = True Then OnTop hwnd
  543. If mnuOnTop.Checked = False Then OffTop hwnd
  544. End Sub
  545. Private Sub mnuOpen_Click()
  546. Dialog1.CancelError = True
  547. Dialog1.filename = ""
  548. On Error GoTo err1
  549. Dialog1.DialogTitle = "Open Image for Viewing"
  550. Dialog1.Flags = &H4 Or &H1000 Or &H800
  551. Dialog1.Filter = "All Supported Formats|*.gif;*.jpg;*.bmp;*.dib;*.wmf;*.emf;*.ico;*.htm*;*.shtm*;*.asp;*.cfm;*.css;*.txt|Gif Images (.gif)|*.gif|Jpeg Images (.jpg)|*.jpg|Bitmap Images (.bmp)|*.bmp|Icons (.ico)|*.ico|OS/2 or Windows DIB (*.dib)|*.dib|Windows Meta File (*.wmf)|*.wmf|Enhanced Windows Meta File (*.emf)|*.emf|HTML and Text Files|*.htm*;*.shtm*;*.asp;*.cfm;*.css;*.txt|All Files (*.*)|*.*"
  552. Dialog1.FilterIndex = 1
  553. Dialog1.ShowOpen
  554. ' If it's a document open it in the HTML viewer
  555.   If Right$(Dialog1.filename, 4) = ".htm" Or Right$(Dialog1.filename, 4) = ".css" Or Right$(Dialog1.filename, 4) = ".txt" Or Right$(Dialog1.filename, 4) = "html" Or Right$(Dialog1.filename, 4) = ".asp" Or Right$(Dialog1.filename, 4) = "shtm" Then
  556.    frmFastViewHTML.Show
  557.    frmFastViewHTML.WebBrowser1.Navigate Dialog1.filename
  558.    Me.Hide
  559.    Exit Sub
  560.   End If
  561. If Not Dialog1.filename = "" Then
  562.  Set picImage.Picture = LoadPicture(Dialog1.filename) ' Load Picture
  563.  ' Resize the form to fit the image:
  564.  Me.Width = picImage.Width + 95
  565. If hScroll.Visible = True Then Me.Width = Me.Width + hScroll.Width
  566.  Me.Height = picImage.Height + 665
  567. If wScroll.Visible = True Then Me.Height = Me.Height + hScroll.Width
  568.  ' Get the size of image in pixels:
  569.  picGet.Height = picImage.Height
  570.  picGet.Width = picImage.Width
  571.  ' Change the window caption:
  572.  Me.Caption = "FastView32 - " & ExtractName(Dialog1.filename) & " (" & picGet.ScaleWidth & " x " & picGet.ScaleHeight & ")"
  573.  picImage.ToolTipText = Dialog1.filename ' Set ToolTipText
  574.  'Center Form:
  575.  Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
  576.  Form_Paint ' Tile background image
  577. End If
  578. Exit Sub
  579. err1:
  580. If Err = 32755 = True Then
  581. MsgBox Error, vbCritical, "Invalid Picture"
  582. End If
  583. Resume Next
  584. Exit Sub
  585. End Sub
  586. Private Sub mnuOther_Click()
  587. Dialog1.CancelError = True
  588. On Error Resume Next
  589. Dialog1.DialogTitle = "Background Color"
  590. Dialog1.ShowColor
  591. Me.BackColor = Dialog1.Color
  592. err1: Exit Sub
  593. imgTile.Picture = imgBlank.Picture
  594. FormPic = "Nothing"
  595. Form_Paint
  596. End Sub
  597. Private Sub mnuPaste_Click()
  598. On Error GoTo err1
  599. picImage.Picture = Clipboard.GetData
  600.  Me.Width = picImage.Width + 95
  601. If hScroll.Visible = True Then Me.Width = Me.Width + hScroll.Width
  602.  Me.Height = picImage.Height + 665
  603. If wScroll.Visible = True Then Me.Height = Me.Height + hScroll.Width
  604. picGet.Height = picImage.Height
  605. picGet.Width = picImage.Width
  606. Me.Caption = "FastView32 - <Clipboard> (" & picGet.ScaleWidth & " x " & picGet.ScaleHeight & ")"
  607. Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
  608. Exit Sub
  609. err1:
  610. MsgBox Error
  611. MsgBox Err
  612. Exit Sub
  613. End Sub
  614. Private Sub mnuReadme_Click()
  615. Dim sPath As String
  616. sPath = App.Path
  617. If Right$(sPath, 1) <> "\" Then sPath = sPath & "\"
  618. ReturnValue = Shell("Notepad " & sPath & "Readme.txt", 3)
  619. End Sub
  620. Private Sub mnuRed_Click()
  621. imgTile.Picture = imgBlank.Picture
  622. Me.BackColor = &HFF&
  623. FormPic = "Nothing"
  624. Form_Paint
  625. End Sub
  626. Private Sub mnuSave_Click()
  627. Dialog1.CancelError = True
  628. Dialog1.filename = ""
  629. On Error GoTo err1
  630. Dialog1.DialogTitle = "Save Image"
  631. Dialog1.Flags = &H4 Or &H1000 Or &H800
  632. Dialog1.Filter = "Supported Formats|*.bmp;*.wmf;*.emf;*.ico;|Bitmaps (.bmp)|*.bmp|Icons (.ico)|*.ico|Windows Meta File (.wmf)|*.wmf|Enhanced Windows Meta File (.emf)|*.emf|All Files (*.*)|*.*"
  633. Dialog1.FilterIndex = 1
  634. Dialog1.ShowSave
  635. 'bitmap, icon, metafile, or enhanced metafile
  636. If Not Dialog1.filename = "" Then
  637. Me.MousePointer = vbHourglass ' Change cursor to hourglass
  638.  SavePicture picImage.Picture, Dialog1.filename ' Save the picture
  639. Me.MousePointer = vbDefault ' Change the cursor back to default
  640. End If
  641. Exit Sub
  642. err1:
  643. If Err = 32755 = True Then
  644. MsgBox Error, vbCritical, "Invalid Picture"
  645. End If
  646. Resume Next
  647. Exit Sub
  648. End Sub
  649. Private Sub mnuWhite_Click()
  650. imgTile.Picture = imgBlank.Picture
  651. Me.BackColor = &HFFFFFF
  652. FormPic = "Nothing"
  653. Form_Paint
  654. End Sub
  655. Private Sub mnuYellow_Click()
  656. imgTile.Picture = imgBlank.Picture
  657. Me.BackColor = &HFFFF&
  658. FormPic = "Nothing"
  659. Form_Paint
  660. End Sub
  661. Private Sub picSquare_KeyDown(KeyCode As Integer, Shift As Integer)
  662. 'If KeyCode = vbKeyPageUp Then
  663. 'If KeyCode = vbKeyPageDown Then
  664. 'If KeyCode = vbKeyEnd Then
  665. 'If KeyCode = vbKeyHome Then
  666. 'If KeyCode = vbKeyLeft Then
  667. 'If KeyCode = vbKeyUp Then
  668. 'If KeyCode = vbKeyRight Then
  669. 'If KeyCode = vbKeyDown Then
  670. End Sub
  671. Private Sub tmrOnTop_Timer()
  672. mnuOnTop_Click
  673. tmrOnTop.Enabled = False
  674. End Sub
  675. Private Sub wScroll_Change()
  676. picImage.Left = -wScroll.Value 'scroll the horizontal scroll bar
  677. End Sub
  678.