home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Form1
- Caption = "Graphics Viewer - VBX"
- ClientHeight = 6510
- ClientLeft = 60
- ClientTop = 630
- ClientWidth = 9480
- ForeColor = &H00000000&
- Height = 7200
- Left = 0
- LinkTopic = "Form1"
- ScaleHeight = 434
- ScaleMode = 3 'Pixel
- ScaleWidth = 632
- Top = 0
- Width = 9600
- Begin PictureBox Pic_GrayBox
- BackColor = &H00C0C0C0&
- Height = 255
- Left = 9240
- ScaleHeight = 225
- ScaleWidth = 225
- TabIndex = 0
- Top = 6240
- Visible = 0 'False
- Width = 255
- End
- Begin VScrollBar VScroll1
- Height = 6255
- LargeChange = 100
- Left = 9240
- SmallChange = 20
- TabIndex = 2
- Top = 0
- Visible = 0 'False
- Width = 255
- End
- Begin HScrollBar HScroll1
- Height = 255
- LargeChange = 100
- Left = 0
- SmallChange = 20
- TabIndex = 1
- Top = 6240
- Visible = 0 'False
- Width = 9255
- End
- Begin GVBOXVBX GVBox1
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 360
- Left = 0
- TabIndex = 3
- Top = 0
- Visible = 0 'False
- Width = 450
- End
- Begin Menu Mnu_File
- Caption = "&File"
- Begin Menu Mnu_Print
- Caption = "&Print"
- HelpContextID = 2014
- End
- Begin Menu Mnu_Exit
- Caption = "E&xit"
- End
- End
- Begin Menu Mnu_Picture
- Caption = "&Picture"
- HelpContextID = 2010
- Begin Menu Mnu_Open
- Caption = "&Open"
- HelpContextID = 2010
- End
- Begin Menu Mnu_Close
- Caption = "&Close"
- HelpContextID = 2010
- End
- End
- Begin Menu Mnu_Options
- Caption = "&Options"
- Begin Menu Mnu_Auto
- Caption = "&Autosize"
- HelpContextID = 2005
- Begin Menu Mnu_AutoSize
- Caption = "&Off"
- HelpContextID = 2005
- Index = 0
- End
- Begin Menu Mnu_AutoSize
- Caption = "Fit to &Bitmap"
- Checked = -1 'True
- HelpContextID = 2005
- Index = 1
- End
- Begin Menu Mnu_AutoSize
- Caption = "Fit &Horizontally"
- HelpContextID = 2005
- Index = 2
- End
- Begin Menu Mnu_AutoSize
- Caption = "Fit &Vertically"
- HelpContextID = 2005
- Index = 3
- End
- End
- Begin Menu Mnu_Dither
- Caption = "&Dithering..."
- HelpContextID = 2007
- Begin Menu Mnu_Dith
- Caption = "&No Dithering"
- HelpContextID = 2007
- Index = 0
- End
- Begin Menu Mnu_Dith
- Caption = "&Dither Always"
- HelpContextID = 2007
- Index = 1
- End
- Begin Menu Mnu_Dith
- Caption = "Dither Extra &Colors"
- Checked = -1 'True
- HelpContextID = 2007
- Index = 2
- End
- End
- Begin Menu Mnu_Thumbnail
- Caption = "&Thumbnail"
- HelpContextID = 2018
- End
- End
- Begin Menu Mnu_JPEG
- Caption = "&JPEG Options"
- HelpContextID = 2025
- Begin Menu Mnu_DCTM
- Caption = "&DCT Method..."
- HelpContextID = 2006
- Begin Menu Mnu_DCT
- Caption = "&Slow Integer"
- HelpContextID = 2006
- Index = 0
- End
- Begin Menu Mnu_DCT
- Caption = "&Fast Integer"
- Checked = -1 'True
- HelpContextID = 2006
- Index = 1
- End
- Begin Menu Mnu_DCT
- Caption = "Floating &Point"
- HelpContextID = 2006
- Index = 2
- End
- End
- Begin Menu Mnu_JPGDithM
- Caption = "Dithering &Method..."
- HelpContextID = 2007
- Begin Menu Mnu_JPGDith
- Caption = "&None"
- HelpContextID = 2007
- Index = 0
- End
- Begin Menu Mnu_JPGDith
- Caption = "&Ordered"
- Checked = -1 'True
- HelpContextID = 2007
- Index = 1
- End
- Begin Menu Mnu_JPGDith
- Caption = "&Floyd-Steinberg"
- HelpContextID = 2007
- Index = 2
- End
- End
- Begin Menu Mnu_Fancy
- Caption = "&Fancy Upsampline"
- HelpContextID = 2008
- End
- Begin Menu Mnu_TwoPass
- Caption = "&Two Pass Quantize"
- HelpContextID = 2019
- End
- End
- Begin Menu Mnu_Zoom
- Caption = "&Zoom"
- HelpContextID = 2020
- Begin Menu Mnu_Pict
- Caption = "&Picture..."
- HelpContextID = 2020
- Begin Menu Mnu_PZoom
- Caption = "&100%"
- Checked = -1 'True
- HelpContextID = 2020
- Index = 0
- End
- Begin Menu Mnu_PZoom
- Caption = "&200%"
- HelpContextID = 2020
- Index = 1
- End
- Begin Menu Mnu_PZoom
- Caption = "&300%"
- HelpContextID = 2020
- Index = 2
- End
- Begin Menu Mnu_PZoom
- Caption = "&400%"
- HelpContextID = 2020
- Index = 3
- End
- End
- Begin Menu Mnu_Prnt
- Caption = "P&rint..."
- HelpContextID = 2017
- Begin Menu Mnu_PrZoom
- Caption = "&100%"
- HelpContextID = 2017
- Index = 0
- End
- Begin Menu Mnu_PrZoom
- Caption = "&200%"
- Checked = -1 'True
- HelpContextID = 2017
- Index = 1
- End
- Begin Menu Mnu_PrZoom
- Caption = "&300%"
- HelpContextID = 2017
- Index = 2
- End
- Begin Menu Mnu_PrZoom
- Caption = "&400%"
- HelpContextID = 2017
- Index = 3
- End
- Begin Menu Mnu_PrZoom
- Caption = "&500%"
- HelpContextID = 2017
- Index = 4
- End
- End
- End
- Begin Menu Mnu_HelpM
- Caption = "&Help"
- HelpContextID = 2000
- Begin Menu Mnu_Help
- Caption = "&Contents"
- HelpContextID = 2000
- Index = 0
- End
- Begin Menu Mnu_Help
- Caption = "&Events"
- HelpContextID = 2022
- Index = 1
- End
- Begin Menu Mnu_Help
- Caption = "&Properties"
- HelpContextID = 2002
- Index = 2
- End
- Begin Menu Mnu_Help
- Caption = "&Search"
- Index = 3
- End
- Begin Menu Mnu_Help
- Caption = "&Using Help"
- Index = 4
- End
- Begin Menu Mnu_Help
- Caption = "-"
- Index = 5
- End
- Begin Menu Mnu_Help
- Caption = "&About"
- HelpContextID = 2004
- Index = 6
- End
- End
- Option Explicit
- DefInt A-Z
- Dim I%, PX!, PY!
- Const CONTENTS& = 2000
- Const EVENTS& = 2022
- Const MODAL = 1
- Const HELP_CONTEXT = &H1
- Const HELP_HELPONHELP = &H4
- Const PROPERTIES& = 2002
- Const SEARCH& = 1
- Declare Function WinHelp% Lib "User" (ByVal hWnd%, ByVal HelpFile$, ByVal wCommand%, ByVal dwData&)
- Sub Form_Load ()
- ChDir App.Path
- Move 0, 0
- Width = Screen.Width
- Height = Screen.Height
- End Sub
- Sub Form_Resize ()
- If GVBox1.Height > Form1.ScaleHeight Then
- VScroll1.Visible = True
- Else
- VScroll1.Visible = False
- End If
- If GVBox1.Width > Form1.ScaleWidth Then
- HScroll1.Visible = True
- Else
- HScroll1.Visible = False
- End If
- VScroll1.Max = GVBox1.Height - Form1.ScaleHeight + HScroll1.Height
- HScroll1.Max = GVBox1.Width - Form1.ScaleWidth + VScroll1.Width
- If VScroll1.Visible Or HScroll1.Visible Then
- Pic_GrayBox.Visible = True
- Else
- Pic_GrayBox.Visible = False
- End If
- HScroll1.Width = Form1.ScaleWidth - VScroll1.Width
- VScroll1.Height = Form1.ScaleHeight - HScroll1.Height
- HScroll1.Move 0, Form1.ScaleHeight - HScroll1.Height
- VScroll1.Move Form1.ScaleWidth - VScroll1.Width, 0
- Pic_GrayBox.Move Form1.ScaleWidth - VScroll1.Width, Form1.ScaleHeight - HScroll1.Height
- VScroll1.Max = GVBox1.Height - Form1.ScaleHeight + HScroll1.Height
- HScroll1.Max = GVBox1.Width - Form1.ScaleWidth + VScroll1.Width
- End Sub
- Sub HScroll1_Change ()
- PX = -HScroll1.Value
- GVBox1.Move PX, PY
- End Sub
- Sub Mnu_AutoSize_Click (Index As Integer)
- For I = 0 To 3
- Mnu_Autosize(I).Checked = False
- Next I
- GVBox1.AutoSize = Index
- Mnu_Autosize(Index).Checked = True
- End Sub
- Sub Mnu_Close_Click ()
- GVBox1.FileName = ""
- GVBox1.Visible = False
- HScroll1.Visible = False
- VScroll1.Visible = False
- Pic_GrayBox.Visible = False
- End Sub
- Sub Mnu_DCT_Click (Index As Integer)
- For I = 0 To 2
- Mnu_DCT(I).Checked = False
- Next I
- GVBox1.DCTMethod = Index
- Mnu_DCT(Index).Checked = True
- End Sub
- Sub Mnu_Dith_Click (Index As Integer)
- For I = 0 To 2
- Mnu_Dith(I).Checked = False
- Next I
- GVBox1.Dither = Index
- Mnu_Dith(Index).Checked = True
- End Sub
- Sub Mnu_Exit_Click ()
- End
- End Sub
- Sub Mnu_Fancy_Click ()
- If Mnu_Fancy.Checked Then
- Mnu_Fancy.Checked = False
- Else
- Mnu_Fancy.Checked = True
- End If
- GVBox1.FancyUpsampling = Mnu_Fancy.Checked
- End Sub
- Sub Mnu_Help_Click (Index As Integer)
- Dim Ret%
- Select Case Index
- Case 0
- Ret = WinHelp(Form1.hWnd, App.HelpFile, HELP_CONTEXT, CONTENTS)
- Case 1
- Ret = WinHelp(Form1.hWnd, App.HelpFile, HELP_CONTEXT, EVENTS)
- Case 2
- Ret = WinHelp(Form1.hWnd, App.HelpFile, HELP_CONTEXT, PROPERTIES)
- Case 3
- Ret = WinHelp(Form1.hWnd, App.HelpFile, HELP_CONTEXT, SEARCH)
- Case 4
- Ret = WinHelp(Form1.hWnd, "", HELP_HELPONHELP, 0)
- Case 6
- About_Frm.Show MODAL
- End Select
- End Sub
- Sub Mnu_JPGDith_Click (Index As Integer)
- For I = 0 To 2
- Mnu_JPGDith(I).Checked = False
- Next I
- GVBox1.JPEGDither = Index
- Mnu_JPGDith(Index).Checked = True
- End Sub
- Sub Mnu_Open_Click ()
- On Error GoTo Er_Hndl
- GVBox1.Visible = False
- GVBox1.FileName = ""
- GVBox1.GVOpenPicture = True
- If GVBox1.FileName <> "" Then
- GVBox1.Visible = True
- VScroll1.Value = 0
- HScroll1.Value = 0
- GVBox1.Left = 0
- GVBox1.Top = 0
- VScroll1.Visible = False
- HScroll1.Visible = False
- Pic_GrayBox.Visible = False
- Form_Resize
- End If
- Exit Sub
- Er_Hndl:
- Beep
- MsgBox Error$, 48, "Graphics Viewer"
- Exit Sub
- End Sub
- Sub Mnu_Print_Click ()
- Screen.MousePointer = 11
- Printer.Print " "
- Printer.ScaleMode = 3
- GVBox1.PrintX = (Printer.ScaleWidth - GVBox1.Width / (GVBox1.Zoom + 1) * (GVBox1.PrintZoom + 1)) / 2
- GVBox1.PrintY = (Printer.ScaleHeight - GVBox1.Height / (GVBox1.Zoom + 1) * (GVBox1.PrintZoom + 1)) / 2
- GVBox1.PrintHDC = Printer.hDC
- Printer.EndDoc
- Screen.MousePointer = 0
- End Sub
- Sub Mnu_PrZoom_Click (Index As Integer)
- For I = 0 To 4
- Mnu_PrZoom(I).Checked = False
- Next I
- GVBox1.PrintZoom = Index
- Mnu_PrZoom(Index).Checked = True
- End Sub
- Sub Mnu_PZoom_Click (Index As Integer)
- For I = 0 To 3
- Mnu_PZoom(I).Checked = False
- Next I
- GVBox1.Zoom = Index
- Mnu_PZoom(Index).Checked = True
- If GVBox1.Visible Then Form_Resize
- End Sub
- Sub Mnu_Thumbnail_Click ()
- If Mnu_Thumbnail.Checked Then
- Mnu_Thumbnail.Checked = False
- Else
- Mnu_Thumbnail.Checked = True
- End If
- GVBox1.Thumbnail = Mnu_Thumbnail.Checked
- If GVBox1.Thumbnail Then
- VScroll1.Value = 0
- HScroll1.Value = 0
- GVBox1.Left = 0
- GVBox1.Top = 0
- VScroll1.Visible = False
- HScroll1.Visible = False
- Pic_GrayBox.Visible = False
- Else
- If GVBox1.Visible Then Form_Resize
- End If
- End Sub
- Sub Mnu_TwoPass_Click ()
- If Mnu_TwoPass.Checked Then
- Mnu_TwoPass.Checked = False
- Else
- Mnu_TwoPass.Checked = True
- End If
- GVBox1.TwoPassQuantize = Mnu_TwoPass.Checked
- End Sub
- Sub Pic_GrayBox_Click ()
- HScroll1.Value = HScroll1.Max
- VScroll1.Value = VScroll1.Max
- End Sub
- Sub Pic_GrayBox_DblClick ()
- HScroll1.Value = 0
- VScroll1.Value = 0
- End Sub
- Sub VScroll1_Change ()
- PY = -VScroll1.Value
- GVBox1.Move PX, PY
- End Sub
-