简体   繁体   English

消息框按钮文本

[英]Messagebox button text

I've looked around and it appears that everything can be editable in a MessageBox, bar the text on the buttons ( WPF /C#)我环顾四周,似乎所有内容都可以在 MessageBox 中编辑,将按钮上的文本栏( WPF /C#)

MessageBox.Show("Generic Message", "Caption",
    MessageBoxButton.YesNoCancel, MessageBoxImage.Warning)

Is there a way to change the "Yes", "No", "Cancel" text or do I need to write a window to function as a MessageBox to accomplish this?有没有办法更改“是”、“否”、“取消”文本,或者我是否需要编写一个窗口来充当MessageBox来完成此操作? (There isn't any problem doing that; I am just wondering if there is a way in WPF). (这样做没有任何问题;我只是想知道 WPF 中是否有办法)。

You can't do it directly.你不能直接做。 Short of creating your own MessageBox, you could use Win32.SetWindowText() as described here (convert the VB.NET code here ).短创建自己的MessageBox,你可以使用Win32.SetWindowText()所描述的在这里(转换VB.NET代码在这里)。 If you don't want to have to deal with native functions, then a custom MessageBox will be the best option.如果您不想处理本机函数,那么自定义 MessageBox 将是最佳选择。

You can use whatever buttons are offered by the MessageBoxButton enum.您可以使用 MessageBoxButton 枚举提供的任何按钮。 If you want something different, you have to write a custom dialog.如果你想要不同的东西,你必须编写一个自定义对话框。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM