Visual Styles

M

MLM450

I want to use visual styles in my app, but it is causing a problem with
a DLL I use. Is there a way to disable visual styles for that DLL? I do
not have access to the code for the DLL. The DLL's developer is aware
of the problem but will not have a fix ready in time for me.
 
S

Stoitcho Goutsev \(100\)

Hi,

As far as I know the visual stules are enabled for the whole application (or
at least per UI thread) you can't have some of the controls with enabled
visual styles and the other part not.

However I found that enabling visual stules from .NET cause problems some
times. It seems to work OK if the visual styles are enabled not form .NET
code, but by using manifest file.

Here you can find informarmation how to enable visual stules using manifest
files

http://msdn.microsoft.com/library/d...sXPVisualStylesWithControlsOnWindowsForms.asp
 
M

Mick Doherty

You can call SetWindowTheme() (Interop call from uxtheme.dll) to disable
Visual Styles for a specific control. Pass String.Empty to the 2 string
Arguments to disable Visual Styles and null to re-enable.

[DllImport("uxtheme.dll")]
private static extern IntPtr SetWindowTheme(IntPtr hWnd, String
pszSubAppName, String pszSubIdList);
 
M

MLM450

Thanks, Mick. I have tried SetWindowTheme. It does change the
appearance of the dialogs/controls created by the DLL, but the problem
persists. I think I need the visual styles disabled when the dialog is
created.

Any other ideas?
 
M

Mick Doherty

Without knowing anything about the dll or the problems you're encountering,
not really.

Have you tried placing a DoEvents() call after EnableVisualStyles() ?
Have you tried using a Manifest file instead of calling EnableVisualStyles()
?

Are you using VS2002, VS2003 or VS2005?
 
M

MLM450

Thanks for the response.

The one part of the DLL that does not work is a color selection
control. It uses colored buttons that appear raised when selected. The
control will not let the user select a new color when visual styles are
used.

I am using DoEvents() and I have tried using a manifest instead of
EnableVisualStyles. I am using VS2005.

Could something like ActivationContext or AppDomain be used to control
the environment of a DLL? I am not real familiar with them.

Thanks,
Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top