How to change subtitle font color on TCheckBox, TRadioButton, TGroupBox?

I don’t know what my problem is, but I can’t set the font color in DEx2 for controls like TCheckBox, TRadioButton, TGroubBox and TRadioGroup. It doesn't matter if I do this in the IDE or programmatically.

I set the color of clBlack for my form and want my captions to be clWhite, but they will not display color other than clBlack. When I assign a color to the OnShow event of the form and execute it in the debugger, it shows the value that I assigned to it, but it is still black on the screen.

I do not use styles or anything else. Any ideas?

Here is an example of a form: an example of "white on black" http://www.skippix.us/temp/Delphi-Font-Problem.bmp

+7
source share
3 answers

When you use Windows themes in an application, most user settings, such as font colors, are ignored. As a workaround and depending on the component, you can control the owner (only when this function is supported), override the drawing method to use your own color in the font ( TRadioGroup , TGroupBox ), and for components such as TCheckBox and TRadioButton (which are WinAPI control shells), you must intercept WM_PAINT and implement your own code to draw the control.

Also, starting with Delphi-xe2, you can use vcl styles , which allow you to change the appearance of controls, from here (and when possible) you can change the style hooks to apply your own font colors and other settings.

+7
source

A simple and simpler workaround is to create a check box without a title and add a label after it. You can easily change the color of the label. You can also create a new component that binds the label to the checkbox itself. What worked for me on Delphi 2007.

+1
source

It will work under the following settings: Project Settings> Application> Execution Topics = No

0
source

Source: https://habr.com/ru/post/1432088/


All Articles