using System;
using System.Windows.Forms;
using System.Drawing;
class myfrm : Form
{
Button b;
public myfrm()
{
b = new Button();
b.SetBounds(100, 100, 150, 50);
b.Text = "Ok";
this.Controls.Add(b);
b.Click +=new EventHandler(fun);
}
void fun(object o,EventArgs e)
{
DialogResult y=MessageBox.Show("text", "caption", MessageBoxButtons.AbortRetryIgnore,MessageBoxIcon.Asterisk);
/* The other message box button styles
MessageBoxButtons.OK
MessageBoxButtons.OKCancel
MessageBoxButtons.RetryCancel
MessageBoxButtons.YesNo
MessageBoxButtons.YesNoCancel
*/
/* The other message Box Button Icons
MessageBoxIcon.Asterisk
MessageBoxIcon.Error
MessageBoxIcon.Exclamation
MessageBoxIcon.Hand
MessageBoxIcon.Information
MessageBoxIcon.None
MessageBoxIcon.Question
MessageBoxIcon.Stop
MessageBoxIcon.Warning
*
*/
if (y == DialogResult.Abort)
{
MessageBox.Show("Abort Clicked");
}
}
}
class Program
{
static void Main(string[] args)
{
myfrm f = new myfrm();
f.WindowState = FormWindowState.Maximized;
/* Window State Styles
FormWindowState.Maximized
FormWindowState.Minimized
FormWindowState.Normal
*/
f.ShowDialog();
}
}
No comments:
Post a Comment