using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
public class SimpleDialog : Form
{
public SimpleDialog()
{
Button OkButton=new Button();
OkButton.Text = "Ok";
OkButton.DialogResult = DialogResult.OK;
OkButton.Location = new Point(8,20);
OkButton.Size = new Size(50,24);
this.Controls.Add(OkButton);
Button CancelButton=new Button();
CancelButton.Text = "Cancel";
CancelButton.DialogResult = DialogResult.Cancel;
CancelButton.Location = new Point(64,20);
CancelButton.Size = new Size(50,24);
this.Controls.Add(CancelButton);
this.Text="Dialog";
this.Size = new Size(130,90);
this.FormBorderStyle = FormBorderStyle.FixedDialog;
this.StartPosition = FormStartPosition.CenterParent;
this.ControlBox = false;
}
}
public class SimpleDialogTest
{
public static void Main(){
SimpleDialog dlg = new SimpleDialog();
if(dlg.ShowDialog() == DialogResult.OK)
MessageBox.Show("You clicked Ok");
else
MessageBox.Show("You clicked Cancel");
}
}