微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

c# – 从MMC管理单元显示时,表单具有不同的样式

我在MMC管理单元中显示一个对话框.从结果窗格中调用对话框时,它具有 Windows主题.

但是,从管理单元范围窗格上下文菜单调用对话框时,它具有不同的样式.

管理单元用C语言编写,对话框是C#表单. C代码通过COM调用C#代码.

解决方法

调用 Application.EnableVisualStyles()可为您的应用程序启用视觉样式.在应用程序中,该方法通常在应用程序的Main方法调用.但在这种情况下,您可以在窗体的构造函数调用Application.EnableVisualStyles():

public Form1()
{
    InitializeComponent();
    Application.EnableVisualStyles();
}

07001

This method enables visual styles for the application. Visual styles are the colors,fonts,and other visual elements that form an operating system theme. Controls will draw with visual styles if the control and the operating system support it. To have an effect,EnableVisualStyles() must be called before creating any controls in the application; typically,EnableVisualStyles() is the first line in the Main function.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐