May 26, 2009
I've done much research in how to turn off visual styles for a custom drawn control, and coming only close on how to do this.
View 6 Replies
The problem I am seeing is that Application.EnableVisualStyles affects a boolean which tells the control how it should paint itself. I don't have a problem with styles being enabled, but rather getting a button to be drawn without using the visual styles rendering function.
Public Class LookupButton
#Region "Disable Themes"
Method 2 simply does not do anything, nor would I want to use it, since it calls unmanaged code.
Method 1 does the right thing for the button, disabling the theme, but of course it does way more than that causing the entire window/app to blink with/without visual styles. And even if this did work, I wouldn't use it because it effects the entire application.
We need visual styles enabled on progress bars, since marquee will be used on a few database calls.
The button has an image ontop of it which gets cut off by the visual styles rounded corners. And there are a few more controls which would be benificial to turn off visual styles as well.
If there is anyway to manipulate the ButtonRenderer so it does not render using visual styles, this is the solution I am looking for. Having no styling for any buttons is preferable.
This is for a project I am working on for my company. We have Visual Studio 2005 .NET Team Edition (per customer request), and are gold certified (which I don't want to give up community support/supporting the community, but is there any programming forums for us where our answers could be answered before 24 hours and/or the questions goes into consideration when microsoft develops tool?).
To me it seems silly to have Visual Styles enable-able for the whole application, when dealing with the windows api, individual windows/controls can easily be themed or unthemed.