|
-
August 21st, 1999, 08:06 AM
#1
realize palette
I had hard time to realize my palette. Following is the sub. The Result always
gives me "0" which means none of my palette entries was realized. Anybody can tell why?
--------------
Sub SetColorScheme()
Dim PlanesSrc As Long
Dim PaletteSizeSrc As Long
Dim LogPal As LOGPALETTE
Dim ib As Integer
Dim bb As Byte
Dim lpPal As Long
Dim Result As Long
Dim R as Long
' Create a copy of the logic palette and realize it if necessary.
LogPal.palVersion = &H300
LogPal.palNumEntries = 256
For ib = 0 To 255
bb = ib
LogPal.palPalEntry(bb).peRed = bb
LogPal.palPalEntry(bb).peGreen = bb
LogPal.palPalEntry(bb).peBlue = 255 - bb
LogPal.palPalEntry(bb).peFlags = 0
Next ib
hPal = CreatePalette(LogPal)
' Select the palette into the destination and realize it.
hPalPrev = SelectPalette(Pic.hdc, hPal, False)
Result = RealizePalette(Pic.hdc)
R = SelectPalette(Pic.hdc, hPalPrev, True)
R = DeleteObject(hPal)
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|