A checkbox has two components: the actual box, and the adjacent label. You can easily change the colours of the label, simply by using the ForeColor and BackColor properties. But there is no obvious way to change the colours of the box.
The only solution that comes to mind is not to use the native chackbox. Either look for a third-party ActiveX control, or create a pair of images that simulate the ticked and unticked boxes.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
As Mike suggested I have been using a class based on a text box that displays an "X" (or any other character you want) in bold when the underlying field is True and a space if False. This way I can control the background color based on the field value. The text box will accept a "T" or "Y" for True and an "F" or "N" for False. It also responds to mouse clicks to set the value. I also included a property that determines whether a False value has a red background or the default background color.
Be careful changing ANY color. You're likely to run into people that can't see it or even worse, run into legal issues, for example, the ADA in the US. Best suggestion is to leave things at defaults and let the form inherit the system colors set by the user.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.