home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
- Begin VB.Form Form1
- Caption = "Palette Demo"
- ClientHeight = 5055
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 4680
- LinkTopic = "Form1"
- Palette = "PalColor.frx":0000
- PaletteMode = 2 'Custom
- ScaleHeight = 5055
- ScaleWidth = 4680
- StartUpPosition = 3 'Windows Default
- Begin VB.CommandButton Command1
- Caption = "Load New Palette"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 555
- Left = 2340
- TabIndex = 1
- Top = 4290
- Width = 2235
- End
- Begin VB.PictureBox Picture1
- AutoRedraw = -1 'True
- Height = 3645
- Left = 150
- ScaleHeight = 239
- ScaleMode = 3 'Pixel
- ScaleWidth = 288
- TabIndex = 0
- Top = 150
- Width = 4380
- End
- Begin MSComDlg.CommonDialog CommonDialog1
- Left = -225
- Top = 2310
- _ExtentX = 847
- _ExtentY = 847
- FontSize = 2.54052e-29
- End
- Begin VB.Label Label6
- Caption = "Blue"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 225
- Left = 105
- TabIndex = 7
- Top = 4665
- Width = 675
- End
- Begin VB.Label Label5
- Caption = "Green"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 225
- Left = 105
- TabIndex = 6
- Top = 4350
- Width = 705
- End
- Begin VB.Label Label1
- Caption = "Red"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 240
- Left = 105
- TabIndex = 5
- Top = 3990
- Width = 525
- End
- Begin VB.Label Label4
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 1080
- TabIndex = 4
- Top = 4605
- Width = 750
- End
- Begin VB.Label Label3
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 270
- Left = 1080
- TabIndex = 3
- Top = 4245
- Width = 750
- End
- Begin VB.Label Label2
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 195
- Left = 1080
- TabIndex = 2
- Top = 3960
- Width = 750
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub Command1_Click()
- Dim BWidth, BHeight, BSpace As Integer
- Dim ih, iv As Integer
- Dim bxStart, byStart, CIndex As Integer
- Dim clr As Long
- CommonDialog1.Filter = "DIB palettes|*.dib"
- CommonDialog1.ShowOpen
- Form1.Caption = CommonDialog1.FileTitle
- Form1.Palette = LoadPicture("")
- Form1.Palette = LoadPicture(CommonDialog1.filename)
- Form1.Refresh
- BSpace = 2
- BWidth = Int((Picture1.ScaleWidth - 32) / 16)
- BHeight = Int((Picture1.ScaleHeight - 32) / 16)
- For ih = 0 To 15
- For iv = 0 To 15
- CIndex = ih * 16 + iv
- bxStart = ih * (BWidth + BSpace)
- byStart = iv * (BHeight + BSpace)
- clr = &H1000000 + CIndex
- Picture1.Line (bxStart, byStart)-Step(BWidth, BHeight), clr, BF
- Next
- Exit Sub
- End Sub
- Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
- Dim pixel As Long
- Dim Red, Green, Blue As Integer
- pixel = Picture1.Point(X, Y)
- Red = pixel Mod 256
- Green = ((pixel And &HFF00) / 256&) Mod 256&
- Blue = (pixel And &HFF0000) / 65536
- Label2.Caption = Red
- Label3.Caption = Green
- Label4.Caption = Blue
- End Sub
-