
color palette not accessible in 256+ color settings
I am trying to access the color palette of a bitmap image.
The bitmap is of less than 256 colors.
In 256 color mode it works fine but the moment i change my graphic/monitor
settings to 256+ (i.e. 32000+, 16 or24 bit true color)
I have tried many times but it does not seem to work. Please help!!!!!
Code runs like this :
' ######declarations
option explicit
Dim objPic As StdPicture
Dim tmpObjPic As StdPicture
Dim lbl() As Label
Public Type PALET{*filter*}TRY
peRed As Byte
peGreen As Byte
peBlue As Byte
peFlags As Byte
End Type
Public arrPalEntry(256) As PALET{*filter*}TRY
'#####end of declarations
Private Sub Form_Load()
Set objPic = LoadPicture(App.Path & "\images\image1.bmp")
End Sub
Private Sub cmdPalette_Click()
Dim a As Integer
Dim i As Integer
Dim r As Integer
Dim cnt As Long
Dim vartop As Long
Dim varleft As Long
varCreatePalete = apiGetPalet{*filter*}tries(ObjPic.hPal, 0, 256, arrPalEntry(0))
'### draw 256 small labels on the form , each label.backcolor is equal to
the color in the corresponday array element.
vartop = 216
varleft = 70
cnt = 0
Dim cntTot As Long
For a = 0 To 7
r = 0
varleft = 70
vartop = 216 + a * 10 + (a * 7)
For i = 0 To 32
If cnt > 1 Then
Load lbl(cnt) ' lbl() declared in general
declarations above
End
With lbl(cnt)
.Appearance = 0
.visible=false
.Width = 10
.Height = 10
.Top = vartop
.Left = varleft
End With
r = r + 1
vartop = 216 + a * 10 + (a * 7)
varleft = 70 + r * 10 + (r * 7)
lbl(cnt).BackColor = RGB(arrPalEntry(cnt).peRed,
arrPalEntry(cnt).peGreen, arrPalEntry(cnt).peBlue)
If cnt = 255 Then
Exit For
End If
cnt = cnt + 1
Next
If cnt = 255 Then ' two label controls already placed on the form
Exit For
End If
Next
'#### displays the labels on the form
For i = 0 To cnt
lbl(i).Visible = True
Next
End Sub