---------------------- Windows Phone 7手机开发、.Net培训、期待与您交流! ----------------------
1.最简单的,只显示提示信息。
MessageBox.Show("Hello!");
![](https://img-my.csdn.net/uploads/201206/29/1340967212_2718.jpg)
2.可以给消息框加上标题。
MessageBox.Show("出错啦!", "Error");
![](https://img-my.csdn.net/uploads/201206/29/1340967219_3707.jpg)
3.询问是否删除时会用到这个。
if (MessageBox.Show("Delete this user?", "Confirm Message",MessageBoxButtons.OKCancel) == DialogResult.OK)
{
//delete
}
![](https://img-my.csdn.net/uploads/201206/29/1340967223_2142.jpg)
4.可以给MessageBox加上一个Icon,.net提供常见的Icon共选择。
if (MessageBox.Show("Delete this user?", "Confirm Message",MessageBoxButtons.OKCancel,MessageBoxIcon.Question) == DialogResult.OK)
{
//delete
}
![](https://img-my.csdn.net/uploads/201206/29/1340967227_7518.jpg)
5.可以改变MessageBox的默认焦点,如下:
if (MessageBox.Show("Delete this user?", "Confirm Message", MessageBoxButtons.OKCancel,MessageBoxIcon.Question,MessageBoxDefaultButton.Button2) == DialogResult.OK)
{
//delete
}
![](https://img-my.csdn.net/uploads/201206/29/1340967231_5405.jpg)
6.反向显示:
if (MessageBox.Show("Delete this user?", "Confirm Message", MessageBoxButtons.OKCancel,MessageBoxIcon.Question,MessageBoxDefaultButton.Button2,MessageBoxOptions.RtlReading) ==DialogResult.OK)
{
//delete
}
![](https://img-my.csdn.net/uploads/201206/29/1340967237_7261.jpg)
7.添加Help按钮:
if (MessageBox.Show("Delete this user?", "Confirm Message", MessageBoxButtons.OKCancel,MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign,true) ==DialogResult.OK)
{
//delete
}
![](https://img-my.csdn.net/uploads/201206/29/1340967242_8443.jpg)
8.指定帮助文件的路径,点击即可打开该路径下的帮助文件。
if (MessageBox.Show("Delete this user?", "Confirm Message", MessageBoxButtons.OKCancel,MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading,@"/folder/file.htm") == DialogResult.OK)
{
//delete
}
![](https://img-my.csdn.net/uploads/201206/29/1340967246_2688.jpg)
9.HelpNavigator指定常数来指示要显示的帮助文件元素。Find帮助文件将打开到搜索页。
if (MessageBox.Show("Delete this user?", "Confirm Message", MessageBoxButtons.OKCancel,MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading,@"/folder/file.htm", HelpNavigator.Find) == DialogResult.OK)
{
//delete
}
![](https://img-my.csdn.net/uploads/201206/29/1340967250_3867.jpg)
---------------------- Windows Phone 7手机开发 、 .Net培训 、期待与您交流! ----------------------