C# WinForms:如何设置按钮背景颜色?

发布于 2024-10-08 19:49:49 字数 165 浏览 0 评论 0原文

[Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE]

为什么 button1.BackColor = Color.Green 在 Visual Studio 模拟器中工作,但在 Windows CE 5.0 目标上不起作用?

[Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE]

Why does button1.BackColor = Color.Green work in the Visual Studio emulator, but not on the windows CE 5.0 target?

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

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

发布评论

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

评论(1

桜花祭 2024-10-15 19:49:49

该平台内置了 Skinnable UI OS 组件 (SYSGEN_XPSKIN)。皮肤行为会覆盖设置控件颜色的行为,因此您尝试实现的任何颜色更改都是不可见的。您的选择是在您绘制自己的按钮的地方进行用户控制,或者查看 OEM 是否有不包含皮肤的操作系统映像(这是假设您没有办法自己更改操作系统,其中如果还可以使用第三个选项来创建自己的皮肤)。

认为有一个注册表项可以关闭此功能,但我找不到它,而且我没有操作系统中具有可换肤 UI 的设备可供测试。您可以尝试一下设备注册表,看看是否确实存在,但我并不是说肯定存在 - 只是可能存在。

The platform has the Skinnable UI OS component (SYSGEN_XPSKIN) built into it. The skin behavior overrides the behavior of setting the control color, so any color change you try to implement is unseen. Your options are to do a user control where you draw your own button or to see if the OEM has an OS image that doesn't include the skin (this is assuming you don't have a way to change the OS yourself, in which case a third option of creating your own skin would be available too).

I thought there was a registry key to turn this off, but I can't find it and I don't have a device with the skinnable UI in the OS to test. You might play around with the device registry to see if there actually might be one, but I'm not saying that there definitely is one - only that there might be.

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