Home All Groups Group Topic Archive Search About

EnableVisualStyles not working

Author
16 May 2006 7:28 PM
Evans3
I'm creating a program on a windows XP SP2 machine using visual studio
2005 standard edition with .net framework 2.0.  Even when I enable
visual styles the simple form looks like windows 2k not windows XP.
The program looks the same whether or not EnableVisualStyles has been
run.  Very simple issue and any suggestions would be appreciated.
Below is the code:

using System;
using System.Drawing;
using System.Windows.Forms;

class StudentTeaching : Form
{
    [STAThread]
    public static void Main()
    {
        Application.EnableVisualStyles();
        Application.Run(new StudentTeaching());
    }

    public StudentTeaching()
    {
        Text = "Student Teaching";
        AutoSize = true;
        //AutoSizeMode = AutoSizeMode.GrowAndShrink;

        Button btn = new Button();
        btn.Parent = this;
        btn.Text = "test";
        //btn.FlatStyle = FlatStyle.System;
    }
}

Author
16 May 2006 7:54 PM
Mehdi
On 16 May 2006 12:28:27 -0700, Eva***@gmail.com wrote:

> I'm creating a program on a windows XP SP2 machine using visual studio
> 2005 standard edition with .net framework 2.0.  Even when I enable
> visual styles the simple form looks like windows 2k not windows XP.
> The program looks the same whether or not EnableVisualStyles has been
> run.  Very simple issue and any suggestions would be appreciated.

Are you using a windows theme that supports visual style (the windows XP
style not the Windows classic style)? Have you set the FlatStyle properties
of all the controls that have this property to System?
Author
16 May 2006 8:47 PM
Evans3
That was the issue.  My display theme on the computer was set on some
modified setting instead of Windows XP.  Thanks for your help!

AddThis Social Bookmark Button