我想更改应用中显示的消息框按钮中的文字。 因此,例如,我想使用'相机'代替'是'而不是'不'我想使用'媒体库'..任何人都有任何想法?
这是我有多远......
DialogResult dlgResult = MessageBox.Show(“Inport photo”,“选择从哪里导入照片”,MessageBoxButtons.YesNo,MessageBoxIcon.None);
我非常挣扎,欢迎任何想法。 感谢
答案 0 :(得分:3)
您无法更改MessageBox的默认按钮。更好的是,您可以在此Microsoft Phone Toolkit
中使用所需的左右按钮创建自定义消息框,还可以设置功能,如果单击这些按钮会是什么。
要下载NuGet,请点按此处。并在您的项目中按左键单击然后管理NuGet包并搜索Microsoft Phone Toolkit,找到包后只需按安装,然后使用我的下面的代码。
CustomMessageBox messageBox = new CustomMessageBox()
{
Title = "Inport photo", //your title
Message = "Select from where to import photo", //your message
RightButtonContent = "Yes", // you can change this right and left button content
LeftButtonContent = "No",
};
messageBox.Dismissed += (s2, e2) =>
{
switch (e2.Result)
{
case CustomMessageBoxResult.RightButton:
//here your function for right button
break;
case CustomMessageBoxResult.LeftButton:
//here your function for left button
break;
default:
break;
}
};
messageBox.Show();
答案 1 :(得分:2)
默认的Silverlight API不允许您这样做,但是XNA API会这样做。请参阅以下链接: