home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 5 / MasteringVisualBasic5.iso / ch_code / ch08 / palettes / palettes.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-02-20  |  5.3 KB  |  175 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
  3. Begin VB.Form Form1 
  4.    Caption         =   "Using Palettes"
  5.    ClientHeight    =   4680
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   7035
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   4680
  11.    ScaleWidth      =   7035
  12.    StartUpPosition =   3  'Windows Default
  13.    Begin VB.CommandButton Command2 
  14.       Caption         =   "Load Image"
  15.       BeginProperty Font 
  16.          Name            =   "MS Sans Serif"
  17.          Size            =   9.75
  18.          Charset         =   0
  19.          Weight          =   400
  20.          Underline       =   0   'False
  21.          Italic          =   0   'False
  22.          Strikethrough   =   0   'False
  23.       EndProperty
  24.       Height          =   375
  25.       Left            =   3600
  26.       TabIndex        =   6
  27.       Top             =   75
  28.       Width           =   1905
  29.    End
  30.    Begin VB.CommandButton Command1 
  31.       Caption         =   "Load Image"
  32.       BeginProperty Font 
  33.          Name            =   "MS Sans Serif"
  34.          Size            =   9.75
  35.          Charset         =   0
  36.          Weight          =   400
  37.          Underline       =   0   'False
  38.          Italic          =   0   'False
  39.          Strikethrough   =   0   'False
  40.       EndProperty
  41.       Height          =   375
  42.       Left            =   150
  43.       TabIndex        =   5
  44.       Top             =   60
  45.       Width           =   1905
  46.    End
  47.    Begin VB.OptionButton Palette 
  48.       Caption         =   "Custom"
  49.       BeginProperty Font 
  50.          Name            =   "MS Sans Serif"
  51.          Size            =   9.75
  52.          Charset         =   0
  53.          Weight          =   400
  54.          Underline       =   0   'False
  55.          Italic          =   0   'False
  56.          Strikethrough   =   0   'False
  57.       EndProperty
  58.       Height          =   285
  59.       Index           =   2
  60.       Left            =   5160
  61.       TabIndex        =   4
  62.       Top             =   4110
  63.       Width           =   1365
  64.    End
  65.    Begin VB.OptionButton Palette 
  66.       Caption         =   "ZOrder"
  67.       BeginProperty Font 
  68.          Name            =   "MS Sans Serif"
  69.          Size            =   9.75
  70.          Charset         =   0
  71.          Weight          =   400
  72.          Underline       =   0   'False
  73.          Italic          =   0   'False
  74.          Strikethrough   =   0   'False
  75.       EndProperty
  76.       Height          =   315
  77.       Index           =   1
  78.       Left            =   2970
  79.       TabIndex        =   3
  80.       Top             =   4080
  81.       Width           =   1320
  82.    End
  83.    Begin VB.OptionButton Palette 
  84.       Caption         =   "HalfTone"
  85.       BeginProperty Font 
  86.          Name            =   "MS Sans Serif"
  87.          Size            =   9.75
  88.          Charset         =   0
  89.          Weight          =   400
  90.          Underline       =   0   'False
  91.          Italic          =   0   'False
  92.          Strikethrough   =   0   'False
  93.       EndProperty
  94.       Height          =   285
  95.       Index           =   0
  96.       Left            =   270
  97.       TabIndex        =   2
  98.       Top             =   4080
  99.       Value           =   -1  'True
  100.       Width           =   1605
  101.    End
  102.    Begin VB.PictureBox Picture2 
  103.       Height          =   3240
  104.       Left            =   3585
  105.       ScaleHeight     =   3180
  106.       ScaleWidth      =   3240
  107.       TabIndex        =   1
  108.       Top             =   555
  109.       Width           =   3300
  110.    End
  111.    Begin VB.PictureBox Picture1 
  112.       Height          =   3240
  113.       Left            =   150
  114.       ScaleHeight     =   3180
  115.       ScaleWidth      =   3240
  116.       TabIndex        =   0
  117.       Top             =   555
  118.       Width           =   3300
  119.    End
  120.    Begin MSComDlg.CommonDialog CommonDialog1 
  121.       Left            =   6480
  122.       Top             =   30
  123.       _ExtentX        =   847
  124.       _ExtentY        =   847
  125.       FontSize        =   2.54052e-29
  126.    End
  127.    Begin VB.Frame Frame1 
  128.       Height          =   690
  129.       Left            =   105
  130.       TabIndex        =   7
  131.       Top             =   3855
  132.       Width           =   6765
  133.    End
  134. Attribute VB_Name = "Form1"
  135. Attribute VB_GlobalNameSpace = False
  136. Attribute VB_Creatable = False
  137. Attribute VB_PredeclaredId = True
  138. Attribute VB_Exposed = False
  139. Private Sub Command1_Click()
  140.     CommonDialog1.Filter = "Images|*.BMP;*.GIF;*.JPG"
  141.     CommonDialog1.ShowOpen
  142.     If CommonDialog1.filename <> "" Then
  143.         Picture1.Picture = LoadPicture(CommonDialog1.filename)
  144.     End If
  145. End Sub
  146. Private Sub Command2_Click()
  147.     CommonDialog1.Filter = "Images|*.BMP;*.GIF;*.JPG"
  148.     CommonDialog1.ShowOpen
  149.     If CommonDialog1.filename <> "" Then
  150.         Picture2.Picture = LoadPicture(CommonDialog1.filename)
  151.     End If
  152. End Sub
  153. Private Sub Palette_Click(Index As Integer)
  154.     Form1.PaletteMode = Index
  155.     Form1.Refresh
  156. End Sub
  157. Private Sub Picture1_Click()
  158.     If Form1.PaletteMode = 1 Then
  159.         Picture1.ZOrder 0
  160.         Picture2.ZOrder 1
  161.     End If
  162.     If Form1.PaletteMode = 2 Then
  163.         Form1.Palette = Picture1.Image
  164.     End If
  165. End Sub
  166. Private Sub Picture2_Click()
  167.     If Form1.PaletteMode = 1 Then
  168.         Picture2.ZOrder 0
  169.         Picture1.ZOrder 1
  170.     End If
  171.     If Form1.PaletteMode = 2 Then
  172.         Form1.Palette = Picture2.Image
  173.     End If
  174. End Sub
  175.