home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- BorderStyle = 1 'Fixed Single
- Caption = "Palette"
- ClientHeight = 2910
- ClientLeft = 2145
- ClientTop = 3885
- ClientWidth = 5535
- Height = 3600
- Left = 2085
- LinkTopic = "Form1"
- LockControls = -1 'True
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 2910
- ScaleWidth = 5535
- Top = 3255
- Width = 5655
- Begin VB.Frame Frame1
- Caption = "Bit Depth"
- Height = 1575
- Left = 3360
- TabIndex = 9
- Top = 1200
- Width = 2055
- Begin VB.OptionButton opt24Bit
- Caption = "24 bit"
- Height = 255
- Left = 360
- TabIndex = 13
- Top = 1200
- Width = 855
- End
- Begin VB.OptionButton opt8Bit
- Caption = "8 bit"
- Height = 255
- Left = 360
- TabIndex = 12
- Top = 840
- Width = 855
- End
- Begin VB.OptionButton opt4Bit
- Caption = "4 bit"
- Height = 255
- Left = 360
- TabIndex = 11
- Top = 480
- Width = 855
- End
- Begin VB.Label Label3
- Caption = "Change Bit Depth to:"
- Height = 255
- Left = 120
- TabIndex = 10
- Top = 240
- Width = 1815
- End
- End
- Begin ik32Lib.Picbuf Picbuf1
- Height = 2775
- Left = 120
- TabIndex = 14
- Top = 0
- Width = 3135
- _Version = 65541
- _ExtentX = 5530
- _ExtentY = 4895
- _StockProps = 253
- End
- Begin VB.Label Label7
- Caption = "bit image."
- Height = 255
- Left = 4320
- TabIndex = 8
- Top = 840
- Width = 735
- End
- Begin VB.Label lblBitDepth
- Caption = "0"
- Height = 255
- Left = 4080
- TabIndex = 7
- Top = 840
- Width = 255
- End
- Begin VB.Label Label4
- Caption = "This is a"
- Height = 255
- Left = 3360
- TabIndex = 6
- Top = 840
- Width = 735
- End
- Begin VB.Label lblSystem3
- Caption = "system colors."
- Height = 255
- Left = 4440
- TabIndex = 5
- Top = 540
- Visible = 0 'False
- Width = 1035
- End
- Begin VB.Label lblSystemColors
- Caption = "0"
- Height = 255
- Left = 4200
- TabIndex = 4
- Top = 540
- Visible = 0 'False
- Width = 255
- End
- Begin VB.Label lblsystem2
- Caption = "There are "
- Height = 255
- Left = 3360
- TabIndex = 3
- Top = 540
- Visible = 0 'False
- Width = 735
- End
- Begin VB.Label Label2
- Caption = "times."
- Height = 255
- Left = 4140
- TabIndex = 2
- Top = 240
- Width = 495
- End
- Begin VB.Label lblPalCall
- Caption = "0"
- Height = 255
- Left = 3900
- TabIndex = 1
- Top = 240
- Width = 255
- End
- Begin VB.Label Label1
- Caption = "The palette event has been"
- Height = 255
- Left = 3360
- TabIndex = 0
- Top = 0
- Width = 2115
- End
- Begin MSComDlg.CommonDialog CommonDialog1
- Left = 240
- Top = 120
- _Version = 65536
- _ExtentX = 847
- _ExtentY = 847
- _StockProps = 0
- End
- Begin VB.Label Label5
- Caption = "called"
- Height = 195
- Left = 3360
- TabIndex = 15
- Top = 240
- Width = 615
- End
- Begin VB.Menu mnuFile
- Caption = "&File"
- Begin VB.Menu mnuLoad
- Caption = "&Load Image..."
- End
- Begin VB.Menu mnuSave
- Caption = "&Save Image..."
- End
- Begin VB.Menu mnuSpacer
- Caption = "-"
- End
- Begin VB.Menu mnuExit
- Caption = "E&xit"
- Shortcut = ^X
- End
- End
- Begin VB.Menu mnuReload
- Caption = "&Reload"
- End
- Begin VB.Menu mnuPalette
- Caption = "&Palette"
- Begin VB.Menu mnuLoadPal
- Caption = "&Load Palette..."
- End
- Begin VB.Menu mnuSavePal
- Caption = "&Save Palette..."
- End
- Begin VB.Menu mnuSpacer2
- Caption = "-"
- End
- Begin VB.Menu mnuAddSystemColors
- Caption = "&Add System Colors"
- Enabled = 0 'False
- End
- Begin VB.Menu mnuSetScreenPal
- Caption = "&Realize current palette"
- Enabled = 0 'False
- End
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Sub SetInfo()
- Select Case Picbuf1.ColorDepth
- Case 4
- lblSystemColors.Visible = False
- lblsystem2.Visible = False
- lblsystem3.Visible = False
- opt4bit.Value = True
- mnuSetScreenPal.Enabled = True
- mnuAddSystemColors.Enabled = False
- Case 8
- lblSystemColors.Caption = Picbuf1.ColorDepth
- lblSystemColors.Visible = True
- lblsystem2.Visible = True
- lblsystem3.Visible = True
- opt8bit.Value = True
- mnuSetScreenPal.Enabled = True
- mnuAddSystemColors.Enabled = True
- Case 24
- lblSystemColors.Visible = False
- lblsystem2.Visible = False
- lblsystem3.Visible = False
- opt24bit.Value = True
- mnuSetScreenPal.Enabled = False
- mnuAddSystemColors.Enabled = False
- End Select
- lblBitDepth.Caption = Picbuf1.ColorDepth
- End Sub
- Private Sub Form_Load()
- 'set picbuf properties
- InitPicbuf Picbuf1, True, "leaves8.pcx"
- End Sub
- 'Description: This adds the system colors to the
- 'current palette.
- Private Sub mnuAddSystemColors_Click()
- Picbuf1.AddSystemColors
- End Sub
- Private Sub ikExit_Click()
- End Sub
- Private Sub ikLoad_Click()
- 'call sub to select a filename
- LoadImage Picbuf1, CommonDialog1
- End Sub
- 'Description: This sub uses the common dialog control
- 'to load a palette using the loadpal method.
- Private Sub mnuLoadPal_Click()
- CommonDialog1.DialogTitle = "Load Palette"
- CommonDialog1.Filter = "all files|*.*|PAL|*.pal"
- CommonDialog1.FilterIndex = 2
- CommonDialog1.Flags = cdlOFNHideReadOnly Or cdlOFNFileMustExist
- On Error GoTo Cancel_Click
- CommonDialog1.CancelError = True
- CommonDialog1.ShowOpen
- Picbuf1.Filename = CommonDialog1.Filename
- Picbuf1.LoadPal
- Exit Sub
- Cancel_Click:
- If Err.Number = 32755 Then
- Exit Sub
- Else
- MsgBox Err.Description
- End If
- End Sub
- 'Description: This sub saves a palette using the
- 'common dialog control, and the StorePal method.
- Private Sub mnuSavePal_Click()
- CommonDialog1.DialogTitle = "Save Palette"
- CommonDialog1.Filter = "all files|*.*|PAL|*.pal"
- CommonDialog1.FilterIndex = 2
- CommonDialog1.Flags = cdlOFNOverwritePrompt Or cdlOFNHideReadOnly
- On Error GoTo Cancel_Click
- CommonDialog1.CancelError = True
- CommonDialog1.ShowSave
- Picbuf1.Filename = CommonDialog1.Filename
- Picbuf1.StorePal
- Exit Sub
- Cancel_Click:
- If Err.Number = 32755 Then
- Exit Sub
- Else
- MsgBox Err.Description
- End If
- End Sub
- 'Description: Here we set the palette of the image
- 'to match that of the screen
- Private Sub mnuSetScreenPal_Click()
- Picbuf1.SetScreenPal
- End Sub
- Private Sub mnuExit_Click()
- ExitProgram
- End Sub
- Private Sub mnuLoad_Click()
- LoadImage Picbuf1, CommonDialog1
- End Sub
- 'Description: This sub reloads the image by
- 'invoking the load method, with the same filename.
- Private Sub mnuReload_Click()
- Picbuf1.Load
- End Sub
- Private Sub mnuSave_Click()
- SaveImage Picbuf1, CommonDialog1
- End Sub
- Private Sub opt24bit_Click()
- If Picbuf1.ColorDepth <> 24 Then
- Picbuf1.IncreaseColors 24
- SetInfo
- End If
- End Sub
- Private Sub opt4bit_Click()
- If Picbuf1.ColorDepth <> 4 Then
- Picbuf1.ReduceColors 16, True, True, True
- SetInfo
- End If
- End Sub
- Private Sub opt8bit_Click()
- If Picbuf1.ColorDepth <> 8 Then
- If Picbuf1.ColorDepth = 4 Then
- Picbuf1.IncreaseColors 8
- SetInfo
- Else
- Picbuf1.ReduceColors 256, True, True, True
- SetInfo
- End If
- End If
- End Sub
- Private Sub Picbuf1_Change()
- SetInfo
- End Sub
- Private Sub Picbuf1_Palette()
- lblPalCall.Caption = Val(lblPalCall.Caption) + 1
- End Sub
-