gpt4 book ai didi

c# - 按钮在 Windows 7 上有黑色背景

转载 作者:可可西里 更新时间:2023-11-01 14:14:22 25 4
gpt4 key购买 nike

我目前正在将一个针对 WIndows XP 和 Server 2003 的应用程序迁移到 Windows 7(及更高版本)。大多数应用程序运行良好,但某些按钮在 Windows 7 中有黑色背景。

Add Machine in Windows XPWindows XP

Add Machine dialog in Windows 7 Windows 7

该应用程序以 Visual Studio 2005 中的 .NET v2.0 为目标(一旦完成向 Windows 7 的迁移,我们将迁移到更高版本的 .NET 和 Visual Studio)。可用的属性似乎都没有帮助。这是我认为可能相关的属性列表(在 XP 和 7 上相同):

BackColor = ActiveCaptionText
BackgroundImage = (none)
TileBackgroundImageLayout = Tile
ForeColor = ControlText
TextImageRelation = Overlay
UseVisualStyleBackColor = False (changing to True doesn't help)

需要做什么才能使按钮看起来像在 Windows XP 上一样?

最佳答案

ActiveCaption 颜色在 SystemColors 类中定义。这些是在操作系统中设置的。

http://msdn.microsoft.com/en-us/library/system.drawing.systemcolors.aspx

事件标题是事件窗口标题栏的背景颜色。

我认为您需要将 BackColor 属性更改为 Control 以使表单看起来像您想要的那样:

BackColor = SystemColors.Control;

或任何其他想要的颜色。

关于c# - 按钮在 Windows 7 上有黑色背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41679002/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com