【发布时间】:2019-04-30 23:06:31
【问题描述】:
由于某种原因,WPF 附带的 MessageBox 禁用了视觉样式,我找不到打开它们的方法,在 Windows 窗体中,只需在程序开始时调用 Application.EnableVisualStyles() .
为了了解我在说什么,这里有两个例子:
System.Windows.Forms.Application.EnableVisualStyles();
System.Windows.Forms.MessageBox.Show(
"Windows Forms Dialog",
"Message Box Test",
System.Windows.Forms.MessageBoxButtons.OK,
System.Windows.Forms.MessageBoxIcon.Asterisk);
System.Windows.MessageBox.Show(
"WPF Dialog",
"Message Box Test",
System.Windows.MessageBoxButton.OK,
System.Windows.MessageBoxImage.Asterisk);
调用 System.Windows.Forms.Application.EnableVisualStyles() 对 WPF 没有影响。
Extended WPF Toolkit 有一个很好的主题实现,但我正在寻找一种方法来创建与用户正在运行的操作系统相匹配的消息框。如果您希望在每个操作系统上都使用相同的样式,那么 EWPFT 实现非常棒。
【问题讨论】:
-
我必须道歉,是的,这是重复的,不知道为什么我没有在搜索结果中看到它。
-
没问题。我之前遇到过这个问题,所以我知道要搜索“wpf messagebox manifest”。