MessageBox+类
来源:互联网 发布:linux虚拟机插优盘 编辑:程序博客网 时间:2024/06/05 16:54
我们在使用messagebox时,通常采用下面的最简化的方式:
MessageBox.Show("Hello World!");
当我们为messagebox添加标题时,可以这样做:
MessageBox.Show("Hello World!", "A Message");
也可以使用System.Windows.Forms.MessageBoxButtons enumeration为messagebox添加按钮。
MessageBox.Show("Hello World!", "A Message", MessageBoxButtons.OKCancel);
The table below shows the members of the MessageBoxButtons enumeration.
Member Buttons Shown AbortRetryIgnoreAbort, Retry, IgnoreOKOKOKCancelOK, CancelRetryCancelRetry, CancelYesNoYes, NoYesNoCancelYes, No, Cancel
You can also add an icon for your message box to further imply the purpose of the message. You do this by using the members of the MessageBoxIcon enumeration.
MessageBox.Show("Hello World!", "A Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
The table below shows the different icons that you can use for your message box.
InformationUsed when showing information to the user.Error
Hand
StopUsed when showing error messages.Exclamation
WarningUsed when showing warning messages.QuestionUsed when asking a question to the user.
You can use the MessageBoxIcon.None to indicate that the message box will have no icon.
The MessageBoxDefaultButton enumeration tells which of the button is the default, that is, the one that is pressed when the enter key in the keyboard is pushed. It has only 4 member which are Button1, Button2, Button3, Button4. For example, in a message box that has an OK and a Cancel buttons, using MessageBoxDefaultButton.Button1 will make the OK button as the default. When the message box is shown and you pressed Enter in the keyboard, the OK button is pressed.
MessageBox.Show("Hello World!", "A Message", MessageBoxButtons.OKCancel, MessageBoxDefaultButton.Button1);
- MessageBox类
- MessageBox+类
- Java实现MessageBox类
- MessageBox类(二)
- MessageBox类(三)
- MessageBox
- MessageBox()
- MessageBox
- MessageBox
- messageBox
- MessageBox
- MessageBox
- MessageBox()
- MessageBox
- MessageBox
- messagebox
- MessageBox
- MessageBox
- Eclipse常用插件
- hdu4061 A Card Game
- 如何成为Android高手
- Android:Bitmap->Drawble->Byte[]
- Linux线程同步(3): 读写锁(rwlock)
- MessageBox+类
- c中strncmp与memcmp的区别
- Chrome小技巧:如何下载离线版安装文件
- Metasploit Framework 简单介绍
- SSH Secure Shell或者putty里面自动补全功能
- 如何学习编程
- SQL2005合理的索引设计
- 最大子段和
- 太好了日志工具(出炉啦!)