Application.EnableVisualStyles() 有什么作用吗? [英] Does Application.EnableVisualStyles() do anything?

查看:18
本文介绍了Application.EnableVisualStyles() 有什么作用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在理解一门新语言时我很挑剔,最近我开始学习 C#.因此,当我创建一个新的应用程序时,我想知道正在发生的一切 - 在这种情况下是一个新的 Windows 窗体应用程序.我创建了一个并从 Visual Studio 获得了一些生成的代码,其中一行是 Application.EnableVisualStyles().

I'm very picky when it comes to understanding a new language, and recently I've taken up learning C#. So I like to know everything that is going on when I create a new Application - in this case a new Windows Forms Application. I created one and was given some generated code from Visual Studio and one line was Application.EnableVisualStyles().

我在 MSDN 上做了一些研究,发现了这篇文章:Application.EnableVisualStyles().我执行了他们提供的示例,期望在我注释掉所述行时按钮不可见.没啥事儿!似乎什么都没有改变.我知道这是一个非常基本的例子,但不应该有什么改变吗?如果这在 Main() 过程中如此重要,那么它到底在做什么而我错过了?

I did some research on MSDN and found this article: Application.EnableVisualStyles(). I performed the example that they presented expecting the button not to be visible when I commented out the said line. Nothing happened! It appeared that nothing changed. I know this is a very basic example but shouldn't something have changed? If this is so critical in the Main() procedure what exactly is it doing that I'm missing?

推荐答案

是的,但您需要在操作系统中打开某些设置,否则您将无法看到它是什么.

Yes it does, but you need have certain settings turned on in your OS otherwise you won't be able to see what it is.

以下是我系统上相同应用程序的一些屏幕截图:

Here are some screenshots of that same application on my system:

Application.EnableVisualStyles();

// Application.EnableVisualStyles();

如果其他应用程序中的按钮看起来像第二个屏幕截图,那么无论您是否使用 Application.EnableVisualStyles(),您总会看到没有主题的按钮,因为它们已被操作系统关闭 -重新打开它们的方法取决于您的操作系统,但通常需要进入性能 >> 视觉效果对话框.

If buttons in other applications look like the second screenshot then you will always see buttons un-themed regardless of whether you use Application.EnableVisualStyles(), because they are turned off by the OS - the way to turn them back on depends on your OS but usually involves going to the Performance >> Visual Effects dialog.

这篇关于Application.EnableVisualStyles() 有什么作用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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