views:

109

answers:

2

I built a custom control, and with theme support on it looks very strange. Is there any way to make it so that it will always draw with themes off, even if the application is built with theme support on?

EDIT: I found a way to turn theming off and it didn't help much. The problem is that it's a special button descended from TBitBtn, and whenever the button is selected, it tries to draw a border around it with a dotted line and that gets in the way. How can I turn that off?

A: 

u can disable the theme for a component using the SetWindowTheme function found in UxTheme.pas

this will disable the theme for a button and a progressbar

...
SetWindowTheme(Button.Handle, ' ', ' ');
SetWindowTheme(ProgressBar.Handle, ' ', ' ');
...
Remus Rigo
+3  A: 

You can try to copy the implementation of TBitBtn.DrawItem and tweak it to your needs. A search for IsFocused inside the code should give you a guide.

To call your patched code you also have to link in the CNDrawItem method by implementing a similar message handler.

Uwe Raabe
Thanks! I'd already had to copy that function to make things work right. IsFocused was exactly what I was looking for.
Mason Wheeler