home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / gv1 / frmdemo.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-03-03  |  7.4 KB  |  240 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  3. Object = "{075FBEB6-CFEC-11D2-98A0-006097BBCE7F}#87.0#0"; "bbbtn.ocx"
  4. Begin VB.Form frmDemo 
  5.    BorderStyle     =   1  'Fixed Single
  6.    Caption         =   "Graphic Viewer OCX Usage Demo"
  7.    ClientHeight    =   5355
  8.    ClientLeft      =   150
  9.    ClientTop       =   720
  10.    ClientWidth     =   5580
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   5355
  15.    ScaleWidth      =   5580
  16.    StartUpPosition =   3  'Windows Default
  17.    Begin BBGraphicViewer.BBViewer BBViewer1 
  18.       Height          =   4020
  19.       Left            =   0
  20.       TabIndex        =   13
  21.       Top             =   0
  22.       Width           =   5550
  23.       _ExtentX        =   9790
  24.       _ExtentY        =   7091
  25.    End
  26.    Begin MSComDlg.CommonDialog CommonDialog1 
  27.       Left            =   2295
  28.       Top             =   1800
  29.       _ExtentX        =   847
  30.       _ExtentY        =   847
  31.       _Version        =   393216
  32.       Filter          =   "*.*"
  33.    End
  34.    Begin VB.Frame Frame1 
  35.       Caption         =   "Zoom Factor"
  36.       Height          =   1230
  37.       Left            =   0
  38.       TabIndex        =   0
  39.       Top             =   4095
  40.       Width           =   5595
  41.       Begin VB.OptionButton Option1 
  42.          Caption         =   "25%"
  43.          Height          =   285
  44.          Index           =   10
  45.          Left            =   90
  46.          TabIndex        =   10
  47.          Top             =   585
  48.          Width           =   960
  49.       End
  50.       Begin VB.OptionButton Option1 
  51.          Caption         =   "50%"
  52.          Height          =   285
  53.          Index           =   9
  54.          Left            =   1260
  55.          TabIndex        =   9
  56.          Top             =   270
  57.          Width           =   1005
  58.       End
  59.       Begin VB.OptionButton Option1 
  60.          Caption         =   "75%"
  61.          Height          =   285
  62.          Index           =   8
  63.          Left            =   1260
  64.          TabIndex        =   8
  65.          Top             =   585
  66.          Width           =   960
  67.       End
  68.       Begin VB.OptionButton Option1 
  69.          Caption         =   "Actual Size"
  70.          Height          =   285
  71.          Index           =   7
  72.          Left            =   2430
  73.          TabIndex        =   7
  74.          Top             =   270
  75.          Width           =   1140
  76.       End
  77.       Begin VB.OptionButton Option1 
  78.          Caption         =   "125%"
  79.          Height          =   285
  80.          Index           =   6
  81.          Left            =   2430
  82.          TabIndex        =   6
  83.          Top             =   585
  84.          Width           =   960
  85.       End
  86.       Begin VB.OptionButton Option1 
  87.          Caption         =   "150%"
  88.          Height          =   285
  89.          Index           =   5
  90.          Left            =   3690
  91.          TabIndex        =   5
  92.          Top             =   270
  93.          Width           =   960
  94.       End
  95.       Begin VB.OptionButton Option1 
  96.          Caption         =   "200%"
  97.          Height          =   285
  98.          Index           =   4
  99.          Left            =   3690
  100.          TabIndex        =   4
  101.          Top             =   585
  102.          Width           =   960
  103.       End
  104.       Begin VB.OptionButton Option1 
  105.          Caption         =   "300%"
  106.          Height          =   285
  107.          Index           =   3
  108.          Left            =   4770
  109.          TabIndex        =   3
  110.          Top             =   270
  111.          Width           =   780
  112.       End
  113.       Begin VB.OptionButton Option1 
  114.          Caption         =   "400%"
  115.          Height          =   285
  116.          Index           =   2
  117.          Left            =   4770
  118.          TabIndex        =   2
  119.          Top             =   585
  120.          Width           =   780
  121.       End
  122.       Begin VB.OptionButton Option1 
  123.          Caption         =   "10%"
  124.          Height          =   285
  125.          Index           =   0
  126.          Left            =   90
  127.          TabIndex        =   1
  128.          Top             =   270
  129.          Width           =   960
  130.       End
  131.       Begin VB.Label Label1 
  132.          BackStyle       =   0  'Transparent
  133.          Caption         =   "Copyrighted 1999 BiggieboySoftware"
  134.          Height          =   285
  135.          Left            =   1575
  136.          TabIndex        =   12
  137.          Top             =   990
  138.          Width           =   3570
  139.       End
  140.    End
  141.    Begin VB.OptionButton Option1 
  142.       Caption         =   "10%"
  143.       Height          =   285
  144.       Index           =   1
  145.       Left            =   2295
  146.       TabIndex        =   11
  147.       Top             =   2385
  148.       Visible         =   0   'False
  149.       Width           =   960
  150.    End
  151.    Begin VB.Menu filemenu 
  152.       Caption         =   "File"
  153.       Begin VB.Menu Open 
  154.          Caption         =   "Open"
  155.       End
  156.       Begin VB.Menu Exit 
  157.          Caption         =   "Exit"
  158.       End
  159.    End
  160.    Begin VB.Menu about 
  161.       Caption         =   "About"
  162.       Begin VB.Menu aboutin 
  163.          Caption         =   "About"
  164.       End
  165.    End
  166. Attribute VB_Name = "frmDemo"
  167. Attribute VB_GlobalNameSpace = False
  168. Attribute VB_Creatable = False
  169. Attribute VB_PredeclaredId = True
  170. Attribute VB_Exposed = False
  171. '**** A very simple graphic viewer utility to demonstrate the use of
  172. '**** BiggieBoy Software Graphic Viewer OCX component.
  173. Public PictureOpened As Variant
  174. Private Sub aboutin_Click()
  175.     frmAbout.Show vbModal, Me
  176. End Sub
  177. Private Sub Exit_Click()
  178.     End
  179. End Sub
  180. Private Sub Form_Load()
  181. BBViewer1.BackColor = RGB(255, 255, 255)
  182. Call ClearAllOptions
  183. End Sub
  184. Private Sub ClearAllOptions()
  185.     Dim i As Integer
  186.     For i = 0 To 10
  187.         Option1(i).Value = False
  188.         '*** Set all initial values to false
  189.     Next
  190. End Sub
  191. Private Sub Open_Click()
  192.     Dim errstat As Variant
  193.     CommonDialog1.Filter = "Bitmap (*.BMP)|*.BMP|JPG (*.JPG)|*.JPG|GIF (*.GIF)|*.GIF|Icon (*.ICO)|*.ICO|Window Meta Files (*.WMF)|*.WMF|Cursors (*.CUR)|*.CUR"
  194.     CommonDialog1.FileName = "*.bmp;*.jpg;*.gif;*.ico;*.wmf;*.cur"
  195.     CommonDialog1.DialogTitle = "Select A Picture File"
  196.     CommonDialog1.ShowOpen
  197.     PictureOpened = CommonDialog1.FileName
  198.     On Error GoTo errorhandle
  199.     Me.MousePointer = vbHourglass
  200.     Set BBViewer1.Picture = LoadPicture(PictureOpened)
  201.     Me.MousePointer = vbDefault
  202.     Call ClearAllOptions
  203.     Option1(7).Value = True
  204.     '*** Immediately after file is opened, set actual size=true
  205.     Exit Sub
  206. errorhandle:
  207.     If Not CommonDialog1.CancelError Then
  208.         errstat = MsgBox("Format Not supported. Unable to open picture file.", vbCritical)
  209.     End If
  210. End Sub
  211. Private Sub Option1_Click(Index As Integer)
  212.     Dim ZoomFactor
  213.     Option1(Index).Value = True
  214.     ZoomFactor = 1
  215.     Select Case Index
  216.         Case 0
  217.             ZoomFactor = 0.1
  218.         Case 10
  219.             ZoomFactor = 0.25
  220.         Case 9
  221.             ZoomFactor = 0.5
  222.         Case 8
  223.             ZoomFactor = 0.75
  224.         Case 7
  225.             ZoomFactor = 1
  226.         Case 6
  227.             ZoomFactor = 1.25
  228.         Case 5
  229.             ZoomFactor = 1.5
  230.         Case 4
  231.             ZoomFactor = 2
  232.         Case 3
  233.             ZoomFactor = 3
  234.         Case 2
  235.             ZoomFactor = 4
  236.         
  237.     End Select
  238.     BBViewer1.Zoom = ZoomFactor
  239. End Sub
  240.