J
Just Me
I asked this in the VB NG and didn't get a response. I think this NG is no
apt to know this kind of thing so I'm trying here.
Trying to display the palette that is on the clipboard.
I get a palette from the clipboard and I want to make the picturebox display
it and realize it as its palette.
Actually the picturebox is on a usercontrol which is on the form containing
this code.
I get the palette OK and draw it but the colors are dithered so I assume my
attempt to realize it failed.
Any help would be appreciated
lHDataPalette = User.GetClipboardData(CF_PALETTE)
lNumDataPaletteEntries = GDI.GetPaletteEntries(lHDataPalette, 0, 256,
lDataLogPal.palPalEntry)
User.CloseClipboard()
If lNumDataPaletteEntries <> 0 Then
Dim lHDataPal As IntPtr
Dim lHPrevPal As IntPtr
Dim lHDCPic As IntPtr
lDataLogPal.palVersion = &H300S
lDataLogPal.palNumEntries = 256
lHDCPic = User.GetDC(ControlPicture1.PicHandle)
lHDataPal = GDI.CreatePalette(lDataLogPal)
lHPrevPal = GDI.SelectPalette(lHDCPic, lHDataPal, 0)
GDI.RealizePalette(lHDCPic)
lHDataPal = GDI.SelectPalette(lHDCPic, lHPrevPal, 0)
User.ReleaseDC(Handle, lHDCPic)
GDI.DeleteObject(lHDataPal)
apt to know this kind of thing so I'm trying here.
Trying to display the palette that is on the clipboard.
I get a palette from the clipboard and I want to make the picturebox display
it and realize it as its palette.
Actually the picturebox is on a usercontrol which is on the form containing
this code.
I get the palette OK and draw it but the colors are dithered so I assume my
attempt to realize it failed.
Any help would be appreciated
lHDataPalette = User.GetClipboardData(CF_PALETTE)
lNumDataPaletteEntries = GDI.GetPaletteEntries(lHDataPalette, 0, 256,
lDataLogPal.palPalEntry)
User.CloseClipboard()
If lNumDataPaletteEntries <> 0 Then
Dim lHDataPal As IntPtr
Dim lHPrevPal As IntPtr
Dim lHDCPic As IntPtr
lDataLogPal.palVersion = &H300S
lDataLogPal.palNumEntries = 256
lHDCPic = User.GetDC(ControlPicture1.PicHandle)
lHDataPal = GDI.CreatePalette(lDataLogPal)
lHPrevPal = GDI.SelectPalette(lHDCPic, lHDataPal, 0)
GDI.RealizePalette(lHDCPic)
lHDataPal = GDI.SelectPalette(lHDCPic, lHPrevPal, 0)
User.ReleaseDC(Handle, lHDCPic)
GDI.DeleteObject(lHDataPal)