如何用XP Visual Style显示WinForm [英] How display winForm with XP Visual Style

查看:73
本文介绍了如何用XP Visual Style显示WinForm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使用户的操作系统已禁用所有视觉效果,还是可以用XP Visual Style显示我的winForm和winForm控件吗?

Is there anyway possible to display my winForm and winForm controls with XP Visual Style even if the user''s OS had all visual effects disabled?

推荐答案

请看到我对这个问题的评论.实际上,您可以将其视为答案的主要和最基本的部分.但是,我要避免指责过分依赖个人品味(这当然是不正确的),因此这仍然是个人"评论.

因此,这才是真正的答案:是和否.

是的,因为您可以 模仿 您想要的任何样式(逐像素).反过来,这是可能的,因为您始终可以处理所谓的非客户端"窗口消息,该消息实际上定义了所有窗口的所有样式元素的呈现,因此您还需要对所有标准控件进行自定义呈现,因为它们也是样式的主题.这可以通过自定义图形和/或处理WM_PAINT消息来完成.在我们移开否"方面之前,请注意,这将非常困难.和很多(无目的的)工作.另外,是否可以解决?它取决于以XP样式显示"的确切含义.至少,原则上您可以复制并预先存在样式,但这不是通用解决方案.

否,因为如果用户全局禁用样式,则它是有意完成的,并由Windows正确处理.换句话说,有某种样式引擎"作为一个整体被绕过.之后,剩下一些默认"样式,例如默认的旧W2K样式和默认的XP样式.通常,对样式的支持意味着用户可以创建仅由相同样式元素,可选颜色等组成的某些自定义样式,同时共同维护一些在样式上一致的解决方案(我从未见过用户能够从中做出真正吸引人的东西,但这又是个人喜好,这是我要避免的事情;重要的是,此功能以这种方式正式起作用,提供了这种自定义选择.如果这是您真正想要的,则即使您完成了上面是"段落中描述的所有工作,也无法实现.此外,几乎不可能在实际尝试之前就预测某种样式元素在所有模式下的外观,因此,至少可以这么说,我上面描述的模仿是不可靠的.

总的结论:即使您可以为达到目标做些事情,但实践意义不大.而且我可能更愿意说:完全没有道理.

—SA
Please see my comment to the question. Practically, you can consider it as the main and most principle part of the answer. However, I want to avoid accusation in relying on individual taste (which of course would not be correct), so this is still a "personal" comment.

So, here is the real answer: yes and no.

Yes, because you can imitate any style you want, pixel by pixel. In turn, this is possible because you can always handle so-called "non-client" windows message which actually define the rendering of all of the style elements of all windows, by you also would need to do custom rendering of all standard controls, because they are also the subjects of styles. This can be done via custom drawing and/or handling of the WM_PAINT messages. Before we move the the "no" aspects, note that this would be very difficult; and a lot of (purposeless) work. Also, is it solution or not? It depends on the exact meaning of "display with XP style". At least, you can reproduce and preexisting style, in principle, but this is not the universal solution.

No, because if the user disables the styles globally, it is done on purpose and handled by Windows properly. In other words, there is some kind of "style engine" which is bypassed as a whole thing. After that, some "default" styles are left, such as default old W2K style and default XP style. Usually, the support of styles means that the user can create some custom style merely composed of the same style elements, optional colors, etc., all together maintaining some stylistically consistent solution (I never saw users able to make something really attractive out of it, but this would be, again, a matter of individual taste, something I want to avoid; what is important, this feature formally works this way, providing this kind of custom choice). If this is something you really want, you cannot achieve that, even if you do all the work described in the above "yes" paragraph. Besides, it''s almost impossible to predict how some style element will look in all modes before you actually try it, so the imitation I described above cannot be reliable, to say the least.

General conclusion: even though you can do something to approach the goal, it has very little practical sense; and I would probably prefer to say: no sense at all.

—SA


这篇关于如何用XP Visual Style显示WinForm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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