Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 windows xp 中使用 Visual Studio 2010 创建了 windows 窗体应用程序,问题是,移动到 W7 等其他版本..或在我的系统中将主题更改为升级版本也会改变窗体的颜色,所以有人能告诉我如何更改窗体无论这些元素如何,都根据操作系统或主题动态着色???
如果您不想使用系统主题,请在应用程序启动时添加此代码:
Application.VisualStyleState = System.Windows.Forms.VisualStyles.VisualStyleState.NoneEnabled;
您只需从Program.cs文件中注释以下代码:
Program.cs
Application.EnableVisualStyles();
然后应用您想要的任何颜色或主题,无论操作系统如何,它都会受到影响。