Messagebox button text

﹥>﹥吖頭↗ 提交于 2019-12-23 15:31:38

问题


I've looked around and it appears that everything can be editable in a MessageBox, bar the text on the buttons (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? (There isn't any problem doing that; I am just wondering if there is a way in WPF.)


回答1:


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). If you don't want to have to deal with native functions, then a custom MessageBox will be the best option.




回答2:


You can use whatever buttons are offered by the MessageBoxButton enum. If you want something different, you have to write a custom dialog.



来源:https://stackoverflow.com/questions/8761041/messagebox-button-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!