这个问题在这里已经有了答案:
10年前关闭。
Possible Duplicate:
WPF MessageBox window style
出于某种原因,
MessageBox
WPF 附带的视觉样式被禁用,我找不到打开它们的方法,在 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 实现非常棒。
最佳答案
不再使用 MessageBox,P/Invoke TaskDialogIndirect相反 - 它看起来比这两者都好,并且有更多选项(例如,具有任意按钮文本)
关于.net - 有谁知道如何让 WPF MessageBox 看起来更好(比如 Windows Forms equivelant)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5759141/