简体   繁体   English

C#我如何确保我的应用程序在其他系统上看起来一样?

[英]c# how can i make sure that my application will look the same on other systems?

how do i make sure that the application iam developing will look the same on other windows-systems? 我如何确保IAM开发的应用程序在其他Windows系统上看起来相同?

iam developing now on a windows7, with .net 3.5 framework .. (VS 2008) iam现在使用.net 3.5框架..(VS 2008)在Windows7上开发

as an example, i have a toolbar, that i changed its rendermode to system, it looks ok on my windows7, but when i run the application on windows xp, it is different, even the onmouseover backcolor is different. 例如,我有一个工具栏,我将其渲染模式更改为system,在Windows7上看起来还可以,但是当我在Windows XP上运行该应用程序时,它就不同了,甚至onmouseover的背景色也不同了。 .. ..

is there a way to make the application looks like on every windows system (talking abt xp, vista and windows 7 only), lets say like exporting the settings of all the controls with the application !? 有没有一种方法可以使应用程序看起来像在每个Windows系统上(仅与abt xp,vista和Windows 7对话),可以说就像导出应用程序中所有控件的设置一样! or any trick to make sure it will be always the same ? 还是有任何技巧可以确保它始终不变?

thankss in advance 预先感谢

Unless you render the window yourself you're going to always have slight differences between OS'es, they all have different ways of rendering your primitive controls like text boxes, panels, etc. 除非您自己渲染窗口,否则操作系统之间总是会有细微的差别,否则它们都有不同的渲染原始控件(如文本框,面板等)的方式。

Also under windows the background color of a window/control is actually (by default) tied into the theme set in windows. 同样在窗口下,窗口/控件的背景颜色实际上(默认情况下)与窗口中设置的主题绑定。

So allowing people to use their own themes is a plus. 因此,允许人们使用自己的主题是一个加号。 You really shouldn't force a style on people unless you're theming your own application. 除非您要设置自己的应用程序主题,否则您实际上不应该在人们身上施加风格。

You would have to you get a grab on all of the colours, fonts, transperancy, etc. and use them to override every controls' Paint event/method so that they may use your values. 您将必须掌握所有的颜色,字体,透明度等,并使用它们覆盖每个控件的Paint事件/方法,以便它们可以使用您的值。

The only way I see fit would be by writing yourself custom controls while handling these controls appearance throught the Paint() method so that the control may use what you give it. 我认为合适的唯一方法是编写自己的自定义控件,同时通过Paint()方法处理这些控件的外观,以便控件可以使用您提供的内容。 The pain!... 疼痛!...

As SLaks commented, you shouldn't care about such details and let the defaut user preferences take over on the native OS, because some surprises may be encountered over time as if Windows doesn't find the font, for instance, it will replace it with its default, which could lead to horrible results. 正如SLaks所评论的那样,您不应该在意这些细节,而让不谨慎的用户首选项接管本机OS,因为随着时间的流逝,可能会遇到一些意外,好像Windows无法找到该字体,例如它将替换它。其默认值,可能会导致可怕的结果。 That is just one example. 那只是一个例子。 Need others? 需要其他人吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM