问题描述
我会尽量保持简单.
在Windows窗体应用程序中创建的按钮如下所示:
A button created in a Windows Forms Application looks like this:
如果我手动创建表单,则创建的按钮将如下所示:
If I create a form manually, buttons I create will look like this:
我仔细查看了Windows窗体应用程序,发现没有代码可以改变按钮的外观.
I looked thoroughly through the Windows Forms Application and found no code that changes the visual style of buttons.
为什么会发生这种情况?
Is there any simple explanation as to why this is happening?
谢谢.
推荐答案
您将需要调用方法,默认情况下在 Program
类的 Main
方法中调用该方法调用 Application.Run
(当您使用自动生成的代码创建Windows Forms项目时).
You will need to call the EnableVisualStyles
method, which is by default called in the Main
method of the Program
class prior to calling Application.Run
(when you create a Windows Forms project, with the auto-generated code).
这篇关于Windows窗体应用程序-视觉样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!