home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 5 Developer's Kit / vb5 dev kit.iso / dev / gvocx / test.frm (.txt) < prev   
Encoding:
Visual Basic Form  |  1996-06-13  |  15.4 KB  |  520 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H80000005&
  5.    Caption         =   "Graphics Viewer - OCX"
  6.    ClientHeight    =   6510
  7.    ClientLeft      =   60
  8.    ClientTop       =   600
  9.    ClientWidth     =   9480
  10.    BeginProperty Font 
  11.       name            =   "MS Sans Serif"
  12.       charset         =   0
  13.       weight          =   700
  14.       size            =   8.25
  15.       underline       =   0   'False
  16.       italic          =   0   'False
  17.       strikethrough   =   0   'False
  18.    EndProperty
  19.    ForeColor       =   &H00000000&
  20.    Height          =   7200
  21.    Left            =   0
  22.    LinkTopic       =   "Form1"
  23.    ScaleHeight     =   434
  24.    ScaleMode       =   3  'Pixel
  25.    ScaleWidth      =   632
  26.    Top             =   -30
  27.    Width           =   9600
  28.    Begin VB.PictureBox Pic_GrayBox 
  29.       Appearance      =   0  'Flat
  30.       BackColor       =   &H00C0C0C0&
  31.       ForeColor       =   &H80000008&
  32.       Height          =   255
  33.       Left            =   9240
  34.       ScaleHeight     =   225
  35.       ScaleWidth      =   225
  36.       TabIndex        =   0
  37.       Top             =   6240
  38.       Visible         =   0   'False
  39.       Width           =   255
  40.    End
  41.    Begin VB.HScrollBar HScroll1 
  42.       Height          =   255
  43.       LargeChange     =   100
  44.       Left            =   0
  45.       SmallChange     =   20
  46.       TabIndex        =   1
  47.       Top             =   6240
  48.       Visible         =   0   'False
  49.       Width           =   9255
  50.    End
  51.    Begin VB.VScrollBar VScroll1 
  52.       Height          =   6255
  53.       LargeChange     =   100
  54.       Left            =   9240
  55.       SmallChange     =   20
  56.       TabIndex        =   2
  57.       Top             =   0
  58.       Visible         =   0   'False
  59.       Width           =   255
  60.    End
  61.    Begin GvboxLib.Gvbox Gvbox1 
  62.       Height          =   1500
  63.       Left            =   0
  64.       TabIndex        =   3
  65.       Top             =   0
  66.       Visible         =   0   'False
  67.       Width           =   1500
  68.       _Version        =   65536
  69.       _ExtentX        =   2646
  70.       _ExtentY        =   2646
  71.       _StockProps     =   105
  72.       BackColor       =   16777215
  73.       BorderStyle     =   1
  74.       AutoSize        =   1
  75.       DCTMethod       =   1
  76.       Dither          =   0
  77.       FancyUpsampling =   0   'False
  78.       FileName        =   ""
  79.       JPEGDither      =   1
  80.       PrintX          =   0
  81.       PrintY          =   0
  82.       Thumbnail       =   0
  83.       Zoom            =   1
  84.       PrintZoom       =   1
  85.       TwoPassQuantize =   0   'False
  86.    End
  87.    Begin VB.Menu Mnu_File 
  88.       Caption         =   "&File"
  89.       Begin VB.Menu Mnu_Print 
  90.          Caption         =   "&Print"
  91.          HelpContextID   =   2014
  92.       End
  93.       Begin VB.Menu Mnu_Exit 
  94.          Caption         =   "E&xit"
  95.       End
  96.    End
  97.    Begin VB.Menu Mnu_Picture 
  98.       Caption         =   "&Picture"
  99.       HelpContextID   =   2010
  100.       Begin VB.Menu Mnu_Open 
  101.          Caption         =   "&Open"
  102.          HelpContextID   =   2010
  103.       End
  104.       Begin VB.Menu Mnu_Close 
  105.          Caption         =   "&Close"
  106.          HelpContextID   =   2010
  107.       End
  108.    End
  109.    Begin VB.Menu Mnu_Options 
  110.       Caption         =   "&Options"
  111.       Begin VB.Menu Mnu_Auto 
  112.          Caption         =   "&Autosize"
  113.          HelpContextID   =   2005
  114.          Begin VB.Menu Mnu_AutoSize 
  115.             Caption         =   "&Off"
  116.             HelpContextID   =   2005
  117.             Index           =   0
  118.          End
  119.          Begin VB.Menu Mnu_AutoSize 
  120.             Caption         =   "Fit to &Bitmap"
  121.             Checked         =   -1  'True
  122.             HelpContextID   =   2005
  123.             Index           =   1
  124.          End
  125.          Begin VB.Menu Mnu_AutoSize 
  126.             Caption         =   "Fit &Horizontally"
  127.             HelpContextID   =   2005
  128.             Index           =   2
  129.          End
  130.          Begin VB.Menu Mnu_AutoSize 
  131.             Caption         =   "Fit &Vertically"
  132.             HelpContextID   =   2005
  133.             Index           =   3
  134.          End
  135.       End
  136.       Begin VB.Menu Mnu_Dither 
  137.          Caption         =   "&Dithering..."
  138.          HelpContextID   =   2007
  139.          Begin VB.Menu Mnu_Dith 
  140.             Caption         =   "&No Dithering"
  141.             HelpContextID   =   2007
  142.             Index           =   0
  143.          End
  144.          Begin VB.Menu Mnu_Dith 
  145.             Caption         =   "&Dither Always"
  146.             HelpContextID   =   2007
  147.             Index           =   1
  148.          End
  149.          Begin VB.Menu Mnu_Dith 
  150.             Caption         =   "Dither Extra &Colors"
  151.             Checked         =   -1  'True
  152.             HelpContextID   =   2007
  153.             Index           =   2
  154.          End
  155.       End
  156.       Begin VB.Menu Mnu_Thumbnail 
  157.          Caption         =   "&Thumbnail"
  158.          HelpContextID   =   2018
  159.       End
  160.    End
  161.    Begin VB.Menu Mnu_JPEG 
  162.       Caption         =   "&JPEG Options"
  163.       HelpContextID   =   2025
  164.       Begin VB.Menu Mnu_DCTM 
  165.          Caption         =   "&DCT Method..."
  166.          HelpContextID   =   2006
  167.          Begin VB.Menu Mnu_DCT 
  168.             Caption         =   "&Slow Integer"
  169.             HelpContextID   =   2006
  170.             Index           =   0
  171.          End
  172.          Begin VB.Menu Mnu_DCT 
  173.             Caption         =   "&Fast Integer"
  174.             Checked         =   -1  'True
  175.             HelpContextID   =   2006
  176.             Index           =   1
  177.          End
  178.          Begin VB.Menu Mnu_DCT 
  179.             Caption         =   "Floating &Point"
  180.             HelpContextID   =   2006
  181.             Index           =   2
  182.          End
  183.       End
  184.       Begin VB.Menu Mnu_JPGDithM 
  185.          Caption         =   "Dithering &Method..."
  186.          HelpContextID   =   2007
  187.          Begin VB.Menu Mnu_JPGDith 
  188.             Caption         =   "&None"
  189.             HelpContextID   =   2007
  190.             Index           =   0
  191.          End
  192.          Begin VB.Menu Mnu_JPGDith 
  193.             Caption         =   "&Ordered"
  194.             Checked         =   -1  'True
  195.             HelpContextID   =   2007
  196.             Index           =   1
  197.          End
  198.          Begin VB.Menu Mnu_JPGDith 
  199.             Caption         =   "&Floyd-Steinberg"
  200.             HelpContextID   =   2007
  201.             Index           =   2
  202.          End
  203.       End
  204.       Begin VB.Menu Mnu_Fancy 
  205.          Caption         =   "&Fancy Upsampline"
  206.          HelpContextID   =   2008
  207.       End
  208.       Begin VB.Menu Mnu_TwoPass 
  209.          Caption         =   "&Two Pass Quantize"
  210.          HelpContextID   =   2019
  211.       End
  212.    End
  213.    Begin VB.Menu Mnu_Zoom 
  214.       Caption         =   "&Zoom"
  215.       HelpContextID   =   2020
  216.       Begin VB.Menu Mnu_Pict 
  217.          Caption         =   "&Picture..."
  218.          HelpContextID   =   2020
  219.          Begin VB.Menu Mnu_PZoom 
  220.             Caption         =   "&50%"
  221.             Index           =   0
  222.          End
  223.          Begin VB.Menu Mnu_PZoom 
  224.             Caption         =   "&100%"
  225.             Checked         =   -1  'True
  226.             HelpContextID   =   2020
  227.             Index           =   1
  228.          End
  229.          Begin VB.Menu Mnu_PZoom 
  230.             Caption         =   "&200%"
  231.             HelpContextID   =   2020
  232.             Index           =   2
  233.          End
  234.          Begin VB.Menu Mnu_PZoom 
  235.             Caption         =   "&300%"
  236.             HelpContextID   =   2020
  237.             Index           =   3
  238.          End
  239.          Begin VB.Menu Mnu_PZoom 
  240.             Caption         =   "&400%"
  241.             HelpContextID   =   2020
  242.             Index           =   4
  243.          End
  244.       End
  245.       Begin VB.Menu Mnu_Prnt 
  246.          Caption         =   "P&rint..."
  247.          HelpContextID   =   2017
  248.          Begin VB.Menu Mnu_PrZoom 
  249.             Caption         =   "&100%"
  250.             HelpContextID   =   2017
  251.             Index           =   0
  252.          End
  253.          Begin VB.Menu Mnu_PrZoom 
  254.             Caption         =   "&200%"
  255.             Checked         =   -1  'True
  256.             HelpContextID   =   2017
  257.             Index           =   1
  258.          End
  259.          Begin VB.Menu Mnu_PrZoom 
  260.             Caption         =   "&300%"
  261.             HelpContextID   =   2017
  262.             Index           =   2
  263.          End
  264.          Begin VB.Menu Mnu_PrZoom 
  265.             Caption         =   "&400%"
  266.             HelpContextID   =   2017
  267.             Index           =   3
  268.          End
  269.          Begin VB.Menu Mnu_PrZoom 
  270.             Caption         =   "&500%"
  271.             HelpContextID   =   2017
  272.             Index           =   4
  273.          End
  274.       End
  275.    End
  276.    Begin VB.Menu Mnu_HelpM 
  277.       Caption         =   "&Help"
  278.       HelpContextID   =   2000
  279.       Begin VB.Menu Mnu_Help 
  280.          Caption         =   "&Contents"
  281.          HelpContextID   =   2000
  282.          Index           =   0
  283.       End
  284.       Begin VB.Menu Mnu_Help 
  285.          Caption         =   "&Events"
  286.          HelpContextID   =   2022
  287.          Index           =   1
  288.       End
  289.       Begin VB.Menu Mnu_Help 
  290.          Caption         =   "&Properties"
  291.          HelpContextID   =   2002
  292.          Index           =   2
  293.       End
  294.       Begin VB.Menu Mnu_Help 
  295.          Caption         =   "&Search"
  296.          Index           =   3
  297.       End
  298.       Begin VB.Menu Mnu_Help 
  299.          Caption         =   "&Using Help"
  300.          Index           =   4
  301.       End
  302.       Begin VB.Menu Mnu_Help 
  303.          Caption         =   "-"
  304.          Index           =   5
  305.       End
  306.       Begin VB.Menu Mnu_Help 
  307.          Caption         =   "&About"
  308.          HelpContextID   =   2004
  309.          Index           =   6
  310.       End
  311.    End
  312. Attribute VB_Name = "Form1"
  313. Attribute VB_Creatable = False
  314. Attribute VB_Exposed = False
  315. Option Explicit
  316. DefInt A-Z
  317. Dim I%, PX!, PY!
  318. Const CONTENTS& = 2000
  319. Const EVENTS& = 2022
  320. Const MODAL = 1
  321. Const HELP_CONTEXT = &H1
  322. Const HELP_HELPONHELP = &H4
  323. Const PROPERTIES& = 2002
  324. Const SEARCH& = 1
  325. Private Sub Form_Load()
  326.     ChDir App.Path
  327.     Move 0, 0
  328.     Width = Screen.Width
  329.     Height = Screen.Height
  330. End Sub
  331. Private Sub Form_Resize()
  332.     If GVBox1.Height > Form1.ScaleHeight Then
  333.         VScroll1.Visible = True
  334.     Else
  335.         VScroll1.Visible = False
  336.     End If
  337.     If GVBox1.Width > Form1.ScaleWidth Then
  338.         HScroll1.Visible = True
  339.     Else
  340.         HScroll1.Visible = False
  341.     End If
  342.     VScroll1.Max = GVBox1.Height - Form1.ScaleHeight + HScroll1.Height
  343.     HScroll1.Max = GVBox1.Width - Form1.ScaleWidth + VScroll1.Width
  344.     If VScroll1.Visible Or HScroll1.Visible Then
  345.         Pic_GrayBox.Visible = True
  346.     Else
  347.         Pic_GrayBox.Visible = False
  348.     End If
  349.     If WindowState <> 1 Then
  350.         HScroll1.Width = Form1.ScaleWidth - VScroll1.Width
  351.         VScroll1.Height = Form1.ScaleHeight - HScroll1.Height
  352.         HScroll1.Move 0, Form1.ScaleHeight - HScroll1.Height
  353.         VScroll1.Move Form1.ScaleWidth - VScroll1.Width, 0
  354.         Pic_GrayBox.Move Form1.ScaleWidth - VScroll1.Width, Form1.ScaleHeight - HScroll1.Height
  355.         VScroll1.Max = GVBox1.Height - Form1.ScaleHeight + HScroll1.Height
  356.         HScroll1.Max = GVBox1.Width - Form1.ScaleWidth + VScroll1.Width
  357.         HScroll1.ZOrder
  358.         VScroll1.ZOrder
  359.         Pic_GrayBox.ZOrder
  360.     End If
  361. End Sub
  362. Private Sub HScroll1_Change()
  363.     PX = -HScroll1.Value
  364.     GVBox1.Move PX, PY
  365. End Sub
  366. Private Sub Mnu_AutoSize_Click(Index As Integer)
  367.     For I = 0 To 3
  368.     Mnu_Autosize(I).Checked = False
  369.     Next I
  370.     GVBox1.AutoSize = Index
  371.     Mnu_Autosize(Index).Checked = True
  372. End Sub
  373. Private Sub Mnu_Close_Click()
  374.     GVBox1.filename = ""
  375.     GVBox1.Visible = False
  376.     HScroll1.Visible = False
  377.     VScroll1.Visible = False
  378.     Pic_GrayBox.Visible = False
  379. End Sub
  380. Private Sub Mnu_DCT_Click(Index As Integer)
  381.     For I = 0 To 2
  382.     Mnu_DCT(I).Checked = False
  383.     Next I
  384.     GVBox1.DCTMethod = Index
  385.     Mnu_DCT(Index).Checked = True
  386. End Sub
  387. Private Sub Mnu_Dith_Click(Index As Integer)
  388.     For I = 0 To 2
  389.     Mnu_Dith(I).Checked = False
  390.     Next I
  391.     GVBox1.Dither = Index
  392.     Mnu_Dith(Index).Checked = True
  393. End Sub
  394. Private Sub Mnu_Exit_Click()
  395.     End
  396. End Sub
  397. Private Sub Mnu_Fancy_Click()
  398.     If Mnu_Fancy.Checked Then
  399.         Mnu_Fancy.Checked = False
  400.     Else
  401.         Mnu_Fancy.Checked = True
  402.     End If
  403.     GVBox1.FancyUpsampling = Mnu_Fancy.Checked
  404. End Sub
  405. Private Sub Mnu_Help_Click(Index As Integer)
  406.     Dim Ret%
  407.     Select Case Index
  408.     Case 0
  409.         Ret = WinHelp(Form1.hwnd, App.HelpFile, HELP_CONTEXT, CONTENTS)
  410.     Case 1
  411.         Ret = WinHelp(Form1.hwnd, App.HelpFile, HELP_CONTEXT, EVENTS)
  412.     Case 2
  413.         Ret = WinHelp(Form1.hwnd, App.HelpFile, HELP_CONTEXT, PROPERTIES)
  414.     Case 3
  415.         Ret = WinHelp(Form1.hwnd, App.HelpFile, HELP_CONTEXT, SEARCH)
  416.     Case 4
  417.         Ret = WinHelp(Form1.hwnd, "", HELP_HELPONHELP, 0)
  418.     Case 6
  419.         About_Frm.Show MODAL
  420.     End Select
  421. End Sub
  422. Private Sub Mnu_JPGDith_Click(Index As Integer)
  423.     For I = 0 To 2
  424.     Mnu_JPGDith(I).Checked = False
  425.     Next I
  426.     GVBox1.JPEGDither = Index
  427.     Mnu_JPGDith(Index).Checked = True
  428. End Sub
  429. Private Sub Mnu_Open_Click()
  430.     On Error GoTo Er_Hndl
  431.     GVBox1.Visible = False
  432.     GVBox1.filename = ""
  433.     GVBox1.GVOpenPicture = True
  434.     If GVBox1.filename <> "" Then
  435.         GVBox1.Visible = True
  436.         VScroll1.Value = 0
  437.         HScroll1.Value = 0
  438.         GVBox1.Left = 0
  439.         GVBox1.Top = 0
  440.         VScroll1.Visible = False
  441.         HScroll1.Visible = False
  442.         Pic_GrayBox.Visible = False
  443.         Form_Resize
  444.     End If
  445.     Exit Sub
  446. Er_Hndl:
  447.     Beep
  448.     MsgBox Error$, 48, "Graphics Viewer"
  449.     Exit Sub
  450. End Sub
  451. Private Sub Mnu_Print_Click()
  452.     Screen.MousePointer = 11
  453.     Printer.Print " "
  454.     Printer.ScaleMode = 3
  455.     GVBox1.PrintX = (Printer.ScaleWidth - (GVBox1.bmpw * GVBox1.PrintZoom)) / 2
  456.     GVBox1.PrintY = (Printer.ScaleHeight - (GVBox1.bmph * GVBox1.PrintZoom)) / 2
  457.     GVBox1.PrintHDC = Printer.hDC
  458.     Printer.EndDoc
  459.     Screen.MousePointer = 0
  460. End Sub
  461. Private Sub Mnu_PrZoom_Click(Index As Integer)
  462.     For I = 0 To 4
  463.     Mnu_PrZoom(I).Checked = False
  464.     Next I
  465.     GVBox1.PrintZoom = Index + 1
  466.     Mnu_PrZoom(Index).Checked = True
  467. End Sub
  468. Private Sub Mnu_PZoom_Click(Index As Integer)
  469.     For I = 0 To 3
  470.     Mnu_PZoom(I).Checked = False
  471.     Next I
  472.     If Index = 0 Then
  473.         GVBox1.Zoom = 0.5
  474.     Else
  475.         GVBox1.Zoom = Index
  476.     End If
  477.     Mnu_PZoom(Index).Checked = True
  478.     If GVBox1.Visible Then Form_Resize
  479. End Sub
  480. Private Sub Mnu_Thumbnail_Click()
  481.     If Mnu_Thumbnail.Checked Then
  482.         Mnu_Thumbnail.Checked = False
  483.         GVBox1.Thumbnail = 0
  484.     Else
  485.         Mnu_Thumbnail.Checked = True
  486.         GVBox1.Thumbnail = 100
  487.     End If
  488.     If GVBox1.Thumbnail Then
  489.         VScroll1.Value = 0
  490.         HScroll1.Value = 0
  491.         GVBox1.Left = 0
  492.         GVBox1.Top = 0
  493.         VScroll1.Visible = False
  494.         HScroll1.Visible = False
  495.         Pic_GrayBox.Visible = False
  496.     Else
  497.         If GVBox1.Visible Then Form_Resize
  498.     End If
  499. End Sub
  500. Private Sub Mnu_TwoPass_Click()
  501.     If Mnu_TwoPass.Checked Then
  502.         Mnu_TwoPass.Checked = False
  503.     Else
  504.         Mnu_TwoPass.Checked = True
  505.     End If
  506.     GVBox1.TwoPassQuantize = Mnu_TwoPass.Checked
  507. End Sub
  508. Private Sub Pic_GrayBox_Click()
  509.     HScroll1.Value = HScroll1.Max
  510.     VScroll1.Value = VScroll1.Max
  511. End Sub
  512. Private Sub Pic_GrayBox_DblClick()
  513.     HScroll1.Value = 0
  514.     VScroll1.Value = 0
  515. End Sub
  516. Private Sub VScroll1_Change()
  517.     PY = -VScroll1.Value
  518.     GVBox1.Move PX, PY
  519. End Sub
  520.