WinForms 按钮默认样式已更改? [英] WinForms button default style changed?

查看:42
本文介绍了WinForms 按钮默认样式已更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个小型的 winforms 项目.我已经编写了一个主"表单框(例如自制控件),从中我可以导出我的其他表单.我的问题是默认按钮设计/样式更改为旧的平面"设计,而不是新的3D 样式"(自 vista 起).

i'm writing a small winforms project. i've written a "main" formbox (self made controls eg) from which i derive my other forms. i've the problem that the default button design / style changed to an old "flat" design and not the new "3D-style" (since vista).

这就是我所拥有的

应该是这样的

我从未手动更改设计,所以我真的不知道为什么会发生这种情况.我已经在谷歌和这里搜索过解决方案,但我相信我使用了错误的词来搜索.

i never changed the design manually so i realy don't know why this has happend. i've already searched for a solution in google and here but i belive i'm using the wrong words to search.

有人知道如何将设计改回新的 3D 样式或如何全局更改设计吗?

does somebody know how to change the design back to the new 3D-style or how to change the design globally ?

最好的亚历克斯

推荐答案

您可能在 Main 方法中缺少对 Application.EnableVisualStyles 的调用,它应该看起来像这样:

You're probably missing the call to Application.EnableVisualStyles in your Main method, it should look like this:

[STAThread]
public static void Main() {

    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    using(MainForm form = new MainForm()) {
        Application.Run(form);
    }
}

这篇关于WinForms 按钮默认样式已更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆