Mason Wheeler
Mason Wheeler

Reputation: 84650

Is there a way to keep a button from drawing an outline when selected?

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?

Upvotes: 0

Views: 366

Answers (2)

Uwe Raabe
Uwe Raabe

Reputation: 47819

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.

Upvotes: 3

Remus Rigo
Remus Rigo

Reputation: 1464

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, ' ', ' ');
...

Upvotes: 0

Related Questions