AllAPI Network - The KPD-Team

 
Allapi Network
 API-Guide
 ApiViewer

 API List

 
API Resources
 Tips & Tricks
 VB Tutorials
 Error Lookup
 
Misc Stuff
 VB examples
 VB Tools
 VB Links
 Top Downloads
 
This Site
 Search Engine
 Contact Form
 

Donate to AllAPI.net

How can I change the Windows-palette ?

All you need is a PictureBox and a picture with many different colors. First you'll have to select a palette (with the SelectPalette-function) and then you'll have to set that palette as the global Windows-palette.
This example is best tested in 8-bit modus (256-colors).

Private Declare Function RealizePalette Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function SelectPalette Lib "gdi32" (ByVal hdc As Long, ByVal hPalette As Long, ByVal bForceBackground As Long) As Long
Private Sub Form_Activate()
SelectPalette Picture1.hdc, Picture1.Picture.hPal, False
RealizePalette Picture1.hdc
End Sub

To create your own palette, use the CreatePalette-function.

 

 


Copyright © 1998-2007, The Mentalis.org Team - Privacy statement
Did you find a bug on this page? Tell us!
This site is located at http://allapi.mentalis.org/