c# 如何确保我的应用程序在其他系统上看起来相同?

发布于 2024-09-02 03:50:16 字数 311 浏览 3 评论 0原文

我如何确保我正在开发的应用程序在其他 Windows 系统上看起来相同?

我现在正在使用.net 3.5框架在windows7上开发..(VS 2008)

作为示例,我有一个工具栏,我将其渲染模式更改为系统,它在我的windows7上看起来不错,但是当我在windows上运行应用程序时xp,不一样,甚至鼠标悬停时的背景颜色也不一样。 ..

有没有办法让应用程序看起来像在每个 Windows 系统上(仅谈论 abt xp、vista 和 windows 7),比如说导出应用程序中所有控件的设置!?或者有什么技巧可以确保它始终相同?

提前致谢

how do i make sure that the application iam developing will look the same on other windows-systems?

iam developing now on a windows7, with .net 3.5 framework .. (VS 2008)

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. ..

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 !? or any trick to make sure it will be always the same ?

thankss in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

离鸿 2024-09-09 03:50:16

除非您自己渲染窗口,否则操作系统之间总是会有细微的差异,它们都有不同的方式来渲染原始控件,如文本框、面板等。

此外,在窗口下,窗口/控件的背景颜色是实际上(默认情况下)与 Windows 中设置的主题相关联。

因此,允许人们使用自己的主题是一个优点。你真的不应该把一种风格强加给人们,除非你正在为自己的应用程序设计主题。

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.

花开浅夏 2024-09-09 03:50:16

您必须掌握所有颜色、字体、透明度等,并使用它们来覆盖每个控件的 Paint 事件/方法,以便它们可以使用您的值。

我认为合适的唯一方法是自己编写自定义控件,同时通过 Paint() 方法处理这些控件的外观,以便控件可以使用您提供的内容。痛苦!...

正如 SLaks 评论的那样,您不应该关心这些细节,并让默认的用户首选项接管本机操作系统,因为随着时间的推移,可能会遇到一些意外,就像 Windows 找不到字体一样,例如例如,它将用默认值替换它,这可能会导致可怕的结果。这只是一个例子。还需要其他人吗?

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.

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. 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. That is just one example. Need others?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文