Disabling EnableVisualStyles in C#

  • Thread starter Thread starter Sujay Ghosh
  • Start date Start date
S

Sujay Ghosh

Hi ,

Environment : .NET 2.0 / VS2005

I am creating a usercontrol ( progressbar ) and every time I add my control
to the project it gives a XP progress bar because of the EnableVisualStyles
function .

I want to suppress the EnableVisualStyles from within my component .

I want the normal Windows 2000 look .

Please let me know how can I acheive this .

Thanks in advance .

Sujay
 
Sujay Ghosh said:
Environment : .NET 2.0 / VS2005

I am creating a usercontrol ( progressbar ) and every time I add my
control
to the project it gives a XP progress bar because of the
EnableVisualStyles
function .

I want to suppress the EnableVisualStyles from within my component .

I want the normal Windows 2000 look .

P/invoke with the 'SetWindowTheme' function can be used to disable Windows
XP visual styles for a certain window.
 
Hi ,

I am calling SetWIndowTheme( ) in the InitializeComponent() , and then add
the DLL to my form - the look is proper ( like Windows 2000 ).

But when I start the progress bar using the following code . the theme color
reverts back to XP .

MY COMPONENT
// Progress Bar Component

InitializeComponent ()
{
Core.SetWindowsTheme(myprogressbar.handle, " " , " " )
}

void StartProgessBar ( )
{
myprogressbar.Step = 30;
myprogressbar.PerformStep( ) ;
}

WINDOWS FORMS

// WIndows Forms generated Code
// with EnableVisualStyles


// OnClickButton
{
// Start the progressbar
myProgressMeterComponent.StartProgessBar( );

// I get the XP look again
}


Am I going wrong somewhere .

Please let me know.

Thanks ,

Sujay


--
Sujay Ghosh
Bangalore, INDIA
 
Back
Top