home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / PVb5.0 / VB / SAMPLES / PGUIDE / OPTIMIZE / GRAPHICS.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-01-22  |  8.9 KB  |  275 lines

  1. VERSION 5.00
  2. Begin VB.Form Graphics 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "
  5.    ClientHeight    =   6585
  6.    ClientLeft      =   1980
  7.    ClientTop       =   1905
  8.    ClientWidth     =   7620
  9.    ForeColor       =   &H80000008&
  10.    Icon            =   "GRAPHICS.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    LockControls    =   -1  'True
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    PaletteMode     =   1  'UseZOrder
  16.    ScaleHeight     =   439
  17.    ScaleMode       =   3  'Pixel
  18.    ScaleWidth      =   508
  19.    ShowInTaskbar   =   0   'False
  20.    Tag             =   "Resource"
  21.    Begin VB.PictureBox Picture1 
  22.       Align           =   1  'Align Top
  23.       BeginProperty Font 
  24.          Name            =   "
  25.          Size            =   9
  26.          Charset         =   0
  27.          Weight          =   700
  28.          Underline       =   0   'False
  29.          Italic          =   0   'False
  30.          Strikethrough   =   0   'False
  31.       EndProperty
  32.       Height          =   1335
  33.       Left            =   0
  34.       ScaleHeight     =   1275
  35.       ScaleWidth      =   7560
  36.       TabIndex        =   6
  37.       TabStop         =   0   'False
  38.       Top             =   0
  39.       Width           =   7620
  40.       Begin VB.CommandButton cmdRedraw 
  41.          Caption         =   "
  42. (&R)"
  43.          Default         =   -1  'True
  44.          Height          =   492
  45.          Left            =   5400
  46.          TabIndex        =   2
  47.          Top             =   480
  48.          Width           =   1812
  49.       End
  50.       Begin VB.ListBox lstRedrawType 
  51.          BackColor       =   &H00FFFFFF&
  52.          BeginProperty Font 
  53.             Name            =   "
  54.             Size            =   9
  55.             Charset         =   0
  56.             Weight          =   400
  57.             Underline       =   0   'False
  58.             Italic          =   0   'False
  59.             Strikethrough   =   0   'False
  60.          EndProperty
  61.          Height          =   675
  62.          Left            =   120
  63.          TabIndex        =   0
  64.          Top             =   120
  65.          Width           =   2475
  66.       End
  67.       Begin VB.Frame Frame1 
  68.          Caption         =   "
  69.          Height          =   1095
  70.          Left            =   2850
  71.          TabIndex        =   1
  72.          Top             =   30
  73.          Width           =   1455
  74.          Begin VB.OptionButton optGraphicType 
  75.             Caption         =   "
  76.             Height          =   255
  77.             Index           =   1
  78.             Left            =   120
  79.             TabIndex        =   4
  80.             Top             =   555
  81.             Width           =   1095
  82.          End
  83.          Begin VB.OptionButton optGraphicType 
  84.             Caption         =   "
  85.             Height          =   255
  86.             Index           =   0
  87.             Left            =   120
  88.             TabIndex        =   3
  89.             Top             =   255
  90.             Value           =   -1  'True
  91.             Width           =   975
  92.          End
  93.       End
  94.       Begin VB.Label lblTime 
  95.          Appearance      =   0  'Flat
  96.          BackColor       =   &H80000005&
  97.          BackStyle       =   0  'Transparent
  98.          Caption         =   "
  99.          BeginProperty Font 
  100.             Name            =   "
  101.             Size            =   10.5
  102.             Charset         =   134
  103.             Weight          =   700
  104.             Underline       =   0   'False
  105.             Italic          =   0   'False
  106.             Strikethrough   =   0   'False
  107.          EndProperty
  108.          ForeColor       =   &H00800000&
  109.          Height          =   255
  110.          Left            =   5400
  111.          TabIndex        =   7
  112.          Top             =   120
  113.          Width           =   1815
  114.       End
  115.       Begin VB.Image imgMetafile 
  116.          Appearance      =   0  'Flat
  117.          Height          =   915
  118.          Left            =   135
  119.          Picture         =   "GRAPHICS.frx":030A
  120.          Top             =   405
  121.          Visible         =   0   'False
  122.          Width           =   915
  123.       End
  124.       Begin VB.Image imgBitmap 
  125.          Appearance      =   0  'Flat
  126.          Height          =   1005
  127.          Left            =   1170
  128.          Picture         =   "GRAPHICS.frx":0540
  129.          Top             =   285
  130.          Visible         =   0   'False
  131.          Width           =   1080
  132.       End
  133.    End
  134.    Begin VB.PictureBox Container 
  135.       Align           =   1  'Align Top
  136.       Appearance      =   0  'Flat
  137.       BackColor       =   &H80000005&
  138.       BeginProperty Font 
  139.          Name            =   "
  140.          Size            =   9
  141.          Charset         =   0
  142.          Weight          =   700
  143.          Underline       =   0   'False
  144.          Italic          =   0   'False
  145.          Strikethrough   =   0   'False
  146.       EndProperty
  147.       ForeColor       =   &H80000008&
  148.       Height          =   5535
  149.       Left            =   0
  150.       ScaleHeight     =   367
  151.       ScaleMode       =   3  'Pixel
  152.       ScaleWidth      =   506
  153.       TabIndex        =   5
  154.       TabStop         =   0   'False
  155.       Top             =   1335
  156.       Width           =   7620
  157.       Begin VB.Image cell 
  158.          Appearance      =   0  'Flat
  159.          BorderStyle     =   1  'Fixed Single
  160.          Height          =   1035
  161.          Index           =   0
  162.          Left            =   0
  163.          Picture         =   "GRAPHICS.frx":18AA
  164.          Top             =   240
  165.          Width           =   1110
  166.       End
  167.    End
  168. Attribute VB_Name = "Graphics"
  169. Attribute VB_GlobalNameSpace = False
  170. Attribute VB_Creatable = False
  171. Attribute VB_PredeclaredId = True
  172. Attribute VB_Exposed = False
  173. Option Explicit
  174.  ReSizeCells 
  175.  Cell 
  176.  Stretch 
  177. Dim iFormLoad As Integer
  178. Private Sub cmdRedraw_Click()
  179.     ReDraw
  180. End Sub
  181. Private Sub Form_Load()
  182.   Dim i As Integer
  183.   iFormLoad = True
  184.   PosForm Me
  185.   For i = 1 To 63
  186.     Load cell(i)
  187.     cell(i).Visible = True
  188.   Next i
  189.  listbox
  190.   lstRedrawType.AddItem "
  191.   lstRedrawType.AddItem "
  192.   lstRedrawType.AddItem "
  193.   lstRedrawType.AddItem "
  194.   lstRedrawType.ListIndex = 0
  195. End Sub
  196. Private Sub Form_Resize()
  197.     If WindowState <> 1 And iFormLoad <> True Then
  198.         Container.Height = ScaleHeight - Container.Top
  199.         ReDraw
  200.     End If
  201.     ' 
  202.     iFormLoad = False
  203. End Sub
  204. Private Sub optGraphicType_Click(Index As Integer)
  205. Dim i As Integer
  206.     If Index Then
  207.         cell(0).Picture = imgMetafile.Picture
  208.     Else
  209.         cell(0).Picture = imgBitmap.Picture
  210.     End If
  211.     Screen.MousePointer = 11
  212.     ' 
  213.     ' 
  214.     Container.Visible = False
  215.     For i = 1 To 63
  216.         cell(i).Picture = cell(0).Picture
  217.     Next i
  218.     Container.Visible = True
  219.     Screen.MousePointer = 0
  220. End Sub
  221. Private Sub ReDraw()
  222. Dim start, Finish
  223.     Screen.MousePointer = 11
  224.     start = Timer
  225.     Select Case lstRedrawType.ListIndex
  226.         Case 0
  227.             ReSizeCells0
  228.         Case 1
  229.             ReSizeCells1
  230.         Case 2
  231.             ReSizeCells2
  232.         Case 3
  233.             ReSizeCells3
  234.     End Select
  235.     Finish = Timer
  236.     lblTime = "
  237.  " + Format(Finish - start, "0.000") + " 
  238.     Screen.MousePointer = 0
  239. End Sub
  240. Private Sub ReSizeCells0()
  241. Dim i As Integer
  242.     For i = 0 To 63
  243.         cell(i).Move (i Mod 8) * (Container.ScaleWidth \ 8), (i \ 8) * (Container.ScaleHeight \ 8), Container.ScaleWidth \ 8, Container.ScaleHeight \ 8
  244.     Next i
  245. End Sub
  246. Private Sub ReSizeCells1()
  247. Dim i As Integer, cellwidth As Integer, cellheight As Integer
  248.     cellwidth = Container.ScaleWidth \ 8
  249.     cellheight = Container.ScaleHeight \ 8
  250.     For i = 0 To 63
  251.         cell(i).Move (i Mod 8) * cellwidth, (i \ 8) * cellheight, cellwidth, cellheight
  252.     Next i
  253. End Sub
  254. Private Sub ReSizeCells2()
  255. Dim i As Integer, cellwidth As Integer, cellheight As Integer
  256.     cellwidth = Container.ScaleWidth \ 8
  257.     cellheight = Container.ScaleHeight \ 8
  258.     For i = 0 To 63
  259.         cell(i).Visible = False
  260.         cell(i).Move (i Mod 8) * cellwidth, (i \ 8) * cellheight, cellwidth, cellheight
  261.         cell(i).Visible = True
  262.     Next i
  263. End Sub
  264. Private Sub ReSizeCells3()
  265. Dim i As Integer, cellwidth As Integer, cellheight As Integer
  266.     Container.Visible = False
  267.     cellwidth = Container.ScaleWidth \ 8
  268.     cellheight = Container.ScaleHeight \ 8
  269.     For i = 0 To 63
  270.         cell(i).Move (i Mod 8) * cellwidth, (i \ 8) * cellheight, cellwidth, cellheight
  271.     Next i
  272.     Container.Visible = True
  273.     '
  274. End Sub
  275.