I'm working in a WinForms project.
I have a dark theme activated in Windows and this is a default combobox when it's focused:
And this is when it has no focus:
An horrible and insane white border appears when the control lost focus, I want to avoid that without disabling XP Styles in the project.
I know that maybe the only way is inheriting the control to make my own, the problem is I don't know what I need to do with the control, maybe changing a setstyle property or I don't know.
I think you're trying to solve a problem that isn't in the scope of your application. Isn't this just an issue with the theme in question you are using?
Windows has many themes. The major themes still supported are Classic (pre-XP), Luna (XP), Aero (Vista/Win7), and Modern (Windows 8). All of these can be customized to create an infinite number of possible scenarios.
Most Windows Forms controls are based on Win32 controls which are drawn by the OS according to these system themes.
So you have to understand that on the machine you're testing on what you're seeing is going to vary a lot from what users of the application will see on different versions of Windows with different user preferences.
The simple fact is that if you use WinForms base controls you really should surrender control of the appearance to the OS as much as possible.
It's also widely accepted to create your own application theme that the user can't change or that they have to pick from a predetermined set of themes you have created. Examples of this include Google Chrome, iTunes, Winamp, etc. It is typically an awful lot of work to do this with simple Win32 controls unless you use something like WPF which makes it easier.
The important thing is that you can't really pick and choose which parts of your application to theme. If you want it to look consistent you either take responsibility for the entire theme yourself or follow the Windows standards of using system resource colors such as ControlText, ActiveBorder, AppWorkspace, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With