home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 5 / MasteringVisualBasic5.iso / olympus / ik32_15t / vb4.shr / OptFiles.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-08-07  |  9.2 KB  |  302 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Optimize Palette Files"
  5.    ClientHeight    =   7215
  6.    ClientLeft      =   1770
  7.    ClientTop       =   2040
  8.    ClientWidth     =   7710
  9.    Height          =   7995
  10.    Left            =   1710
  11.    LinkTopic       =   "Form1"
  12.    LockControls    =   -1  'True
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   7215
  16.    ScaleWidth      =   7710
  17.    Top             =   1320
  18.    Width           =   7830
  19.    Begin VB.TextBox txtLocPB1 
  20.       Height          =   315
  21.       Left            =   120
  22.       TabIndex        =   17
  23.       Text            =   "txtLocPB1"
  24.       Top             =   0
  25.       Width           =   4335
  26.    End
  27.    Begin VB.TextBox cd4 
  28.       Height          =   285
  29.       Left            =   6180
  30.       TabIndex        =   13
  31.       Text            =   "cd4"
  32.       Top             =   6840
  33.       Width           =   435
  34.    End
  35.    Begin VB.TextBox cd3 
  36.       Height          =   285
  37.       Left            =   3660
  38.       TabIndex        =   12
  39.       Text            =   "cd3"
  40.       Top             =   6840
  41.       Width           =   435
  42.    End
  43.    Begin VB.TextBox cd2 
  44.       Height          =   285
  45.       Left            =   1140
  46.       TabIndex        =   11
  47.       Text            =   "cd2"
  48.       Top             =   6840
  49.       Width           =   435
  50.    End
  51.    Begin VB.TextBox cd1 
  52.       Height          =   285
  53.       Left            =   1140
  54.       TabIndex        =   9
  55.       Text            =   "cd1"
  56.       Top             =   3840
  57.       Width           =   435
  58.    End
  59.    Begin VB.TextBox txtLocPB3 
  60.       Height          =   315
  61.       Left            =   2640
  62.       TabIndex        =   4
  63.       Text            =   "txtLocPB3"
  64.       Top             =   4200
  65.       Width           =   2415
  66.    End
  67.    Begin VB.TextBox txtLocPB4 
  68.       Height          =   315
  69.       Left            =   5160
  70.       TabIndex        =   3
  71.       Text            =   "txtLocPB4"
  72.       Top             =   4200
  73.       Width           =   2415
  74.    End
  75.    Begin VB.TextBox txtLocPB2 
  76.       Height          =   315
  77.       Left            =   120
  78.       TabIndex        =   2
  79.       Text            =   "txtLocPB2"
  80.       Top             =   4200
  81.       Width           =   2415
  82.    End
  83.    Begin VB.CommandButton cmdOptimFiles 
  84.       Caption         =   "OptimizePal&Files"
  85.       Height          =   315
  86.       Left            =   6120
  87.       TabIndex        =   1
  88.       Top             =   0
  89.       Width           =   1455
  90.    End
  91.    Begin VB.CommandButton cmdOptim 
  92.       Caption         =   "&OptimizePal"
  93.       Height          =   315
  94.       Left            =   4560
  95.       TabIndex        =   0
  96.       Top             =   0
  97.       Width           =   1455
  98.    End
  99.    Begin ik32Lib.Picbuf PicbufSrc3 
  100.       Height          =   2175
  101.       Left            =   5160
  102.       TabIndex        =   8
  103.       Top             =   4560
  104.       Width           =   2415
  105.       _Version        =   65536
  106.       _ExtentX        =   4260
  107.       _ExtentY        =   3836
  108.       _StockProps     =   253
  109.    End
  110.    Begin ik32Lib.Picbuf PicbufSrc2 
  111.       Height          =   2175
  112.       Left            =   2640
  113.       TabIndex        =   7
  114.       Top             =   4560
  115.       Width           =   2415
  116.       _Version        =   65536
  117.       _ExtentX        =   4260
  118.       _ExtentY        =   3836
  119.       _StockProps     =   253
  120.    End
  121.    Begin ik32Lib.Picbuf PicbufSrc1 
  122.       Height          =   2175
  123.       Left            =   90
  124.       TabIndex        =   6
  125.       Top             =   4590
  126.       Width           =   2415
  127.       _Version        =   65536
  128.       _ExtentX        =   4260
  129.       _ExtentY        =   3836
  130.       _StockProps     =   253
  131.    End
  132.    Begin ik32Lib.Picbuf PicbufDest 
  133.       Height          =   3375
  134.       Left            =   120
  135.       TabIndex        =   5
  136.       Top             =   360
  137.       Width           =   7455
  138.       _Version        =   65536
  139.       _ExtentX        =   13150
  140.       _ExtentY        =   5953
  141.       _StockProps     =   253
  142.    End
  143.    Begin MSComDlg.CommonDialog CommonDialog1 
  144.       Left            =   2070
  145.       Top             =   3780
  146.       _Version        =   65536
  147.       _ExtentX        =   847
  148.       _ExtentY        =   847
  149.       _StockProps     =   0
  150.    End
  151.    Begin VB.Label Label4 
  152.       Caption         =   "Color Depth:"
  153.       Height          =   195
  154.       Left            =   5160
  155.       TabIndex        =   16
  156.       Top             =   6900
  157.       Width           =   975
  158.    End
  159.    Begin VB.Label Label3 
  160.       Caption         =   "Color Depth:"
  161.       Height          =   195
  162.       Left            =   2640
  163.       TabIndex        =   15
  164.       Top             =   6900
  165.       Width           =   975
  166.    End
  167.    Begin VB.Label Label2 
  168.       Caption         =   "Color Depth:"
  169.       Height          =   195
  170.       Left            =   120
  171.       TabIndex        =   14
  172.       Top             =   6900
  173.       Width           =   975
  174.    End
  175.    Begin VB.Label Label1 
  176.       Caption         =   "Color Depth:"
  177.       Height          =   195
  178.       Left            =   120
  179.       TabIndex        =   10
  180.       Top             =   3900
  181.       Width           =   975
  182.    End
  183.    Begin VB.Menu mnuFile 
  184.       Caption         =   "&File"
  185.       Begin VB.Menu mnuLoadDest 
  186.          Caption         =   "&Load Destination Image..."
  187.       End
  188.       Begin VB.Menu mnuLoadSrc1 
  189.          Caption         =   "Load Source &1 Image..."
  190.       End
  191.       Begin VB.Menu mnuLoadSrc2 
  192.          Caption         =   "Load Source &2 Image..."
  193.       End
  194.       Begin VB.Menu mnuLoadSrc3 
  195.          Caption         =   "Load Source &3 Image..."
  196.       End
  197.       Begin VB.Menu mnuSaveDest 
  198.          Caption         =   "&Save Destination Image..."
  199.       End
  200.       Begin VB.Menu mnuSpacer 
  201.          Caption         =   "-"
  202.       End
  203.       Begin VB.Menu mnuExit 
  204.          Caption         =   "E&xit"
  205.          Shortcut        =   ^X
  206.       End
  207.    End
  208.    Begin VB.Menu mnuReload 
  209.       Caption         =   "&Reload"
  210.    End
  211. Attribute VB_Name = "Form1"
  212. Attribute VB_Creatable = False
  213. Attribute VB_Exposed = False
  214. Option Explicit
  215. Dim PBControls(1 To 3) As Object
  216. Dim Files(1 To 3) As String
  217. 'Description: This sub sets up an array of picbufs
  218. Sub SetupControls()
  219.     Set PBControls(1) = PicbufSrc1
  220.     Set PBControls(2) = PicbufSrc2
  221.     Set PBControls(3) = PicbufSrc3
  222. End Sub
  223. 'Description: This code sets up an array of files
  224. 'to be used with OptimizePalFiles
  225. Sub SetupFiles()
  226.     Files(1) = App.Path + "\..\images\rgb8.bmp"
  227.     Files(2) = App.Path + "\..\images\white8.bmp"
  228.     Files(3) = App.Path + "\..\images\cat8.bmp"
  229. End Sub
  230. 'Description: This code optimizes the palette of the
  231. 'destination picbuf.
  232. Private Sub cmdOptim_Click()
  233.     PicbufDest.OptimizePal PBControls, 3, 100
  234. End Sub
  235. 'Description: This code optimizes the destination
  236. 'image to three files specified in the sub
  237. 'SetupFiles
  238. Private Sub cmdOptimFiles_Click()
  239.     PicbufDest.OptimizePalFiles PBControls, 3, Files, 3, 100
  240. End Sub
  241. 'Description: This code loads images into the
  242. 'picbufs, and sets default values for labels,
  243. 'and text boxes.
  244. Private Sub Form_Load()
  245.     InitPicbuf PicbufDest, True, "marybeth.tif"
  246.     InitPicbuf PicbufSrc1, True, "leaves8.pcx"
  247.     InitPicbuf PicbufSrc2, True, "bambi1.bmp"
  248.     InitPicbuf PicbufSrc3, True, "winlogo1.bmp"
  249.     txtLocPB1.Text = PicbufDest.Filename
  250.     txtLocPB2.Text = PicbufSrc1.Filename
  251.     txtLocPB3.Text = PicbufSrc2.Filename
  252.     txtLocPB4.Text = PicbufSrc3.Filename
  253.     cd1.Text = Str$(PicbufDest.ColorDepth)
  254.     cd2.Text = Str$(PicbufSrc1.ColorDepth)
  255.     cd3.Text = Str$(PicbufSrc2.ColorDepth)
  256.     cd4.Text = Str$(PicbufSrc3.ColorDepth)
  257.     SetupFiles
  258.     SetupControls
  259. End Sub
  260. 'Description: This ends the program.
  261. Private Sub mnuExit_Click()
  262.     ExitProgram
  263. End Sub
  264. 'Description: This code loads an image into the
  265. 'picbuf using the common dialog control.
  266. Private Sub mnuLoadDest_Click()
  267.     LoadImage PicbufDest, CommonDialog1
  268.     cd1.Text = Str$(PicbufDest.ColorDepth)
  269.     txtLocPB1.Text = PicbufDest.Filename
  270. End Sub
  271. 'Description: This code loads an image into the
  272. 'picbuf using the common dialog control.
  273. Private Sub mnuLoadSrc1_Click()
  274.     LoadImage PicbufSrc1, CommonDialog1
  275.     cd2.Text = Str$(PicbufSrc1.ColorDepth)
  276.     txtLocPB2.Text = PicbufSrc1.Filename
  277. End Sub
  278. 'Description: This code loads an image into the
  279. 'picbuf using the common dialog control.
  280. Private Sub mnuLoadSrc2_Click()
  281.     LoadImage PicbufSrc2, CommonDialog1
  282.     cd3.Text = Str$(PicbufSrc2.ColorDepth)
  283.     txtLocPB3.Text = PicbufSrc2.Filename
  284. End Sub
  285. 'Description: This code loads an image into the
  286. 'picbuf using the common dialog control.
  287. Private Sub mnuLoadSrc3_Click()
  288.     LoadImage PicbufSrc3, CommonDialog1
  289.     cd4.Text = Str$(PicbufSrc3.ColorDepth)
  290.     txtLocPB4.Text = PicbufSrc3.Filename
  291. End Sub
  292. 'Description: This code reloads the image in the
  293. 'destination picbuf.
  294. Private Sub mnuReload_Click()
  295.     PicbufDest.Load
  296. End Sub
  297. 'Description: This code saves the image in the
  298. 'picbuf using the common dialog control.
  299. Private Sub mnuSaveDest_Click()
  300.     SaveImage PicbufDest, CommonDialog1
  301. End Sub
  302.