我怎样才能显示一个“叮”的消息框声音和一个红色的’关闭’按钮在里面?这就是我说的:
我试图创建一些自定义错误和警告,但是:
MessageBox.Show("asdf");
似乎没有给我任何定制选项。
Try this:
MessageBox.Show("Some text", "Some title", MessageBoxButtons.OK, MessageBoxIcon.Error);
Try details: use any option:
MessageBox.Show( "your message", "window title", MessageBoxButtons.OK, MessageBoxIcon.Warning // for Warning //MessageBoxIcon.Error // for Error //MessageBoxIcon.Information // for Information //MessageBoxIcon.Question // for Question );
MessageBox.Show( "your message", "window title", MessageBoxButtons.OK, MessageBoxIcon.Asterisk //For Info Asterisk MessageBoxIcon.Exclamation //For triangle Warning )
You should add namespace if you are not using it:
System.Windows.Forms.MessageBox.Show("Some text", "Some title", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
Alternatively, you can add at the begining of your file:
using System.Windows.Forms
and then use (as stated in previous answers):