English 中文(简体)
视像方式
原标题:Windows Forms Application - Visual Style?

我试图尽可能简单地这样做。

在Windows表格中创建的纽顿像:

“entergraph

如果我以人工方式创建一种形式,那么我所创建的纽托邦就是这样:

“entergraph

我通过Windows表格应用程序进行了彻底研究,发现没有任何密码改变纽芬兰语的视觉风格。

是否有简单解释为什么发生这种情况?

提前感谢。

最佳回答

http://msdn.microsoft.com/en-us/library/system.windows.forms.application.enable pornographys.aspx>EnableVisualStyles, 这种方法在Main <>/code>上用,在打上<代码>,Program/code>类别之前用在。 见Run(当你创立一个配有自动生成代码的Windows表格项目时)。

This method enables visual styles for the application. Visual styles are the colors, fonts, and other visual elements that form an operating system theme. Controls will draw with visual styles if the control and the operating system support it. To have an effect, EnableVisualStyles() must be called before creating any controls in the application; typically, EnableVisualStyles() is the first line in the Main function. A separate manifest is not required to enable visual styles when calling EnableVisualStyles().

问题回答

• 确保你制定<编码>UseVisualStyleBackColor至true,并注明Application。 EnableVisualStyles(); in theirstartup Code.

static class Program
{
    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new frmAddress());
    }

}

EDIT: Effect of UseVisualStyleBackColor:

“entergraph

I had a similar problem. Untill before VS 2010, creating a custom manifest file did the job. However from Visual Studio 2010, this does not work, because VS creates a new file named app.manifest, inside the folder My Project. So, to enable visual styles all you have to do is to edit this file from withing your project in Visual Studio and uncomment the lines bellow

<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签