权限界面程序
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void btnLogin_Click(object sender, EventArgs e)
{
//通过获取设置的DialogResult结果来确定点击的按钮
this.DialogResult = DialogResult.OK;
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
}
主程序界面
private void button1_Click(object sender, EventArgs e)
{
Form2 f = new Form2();
f.ShowDialog();
if (f.DialogResult ==DialogResult .OK )
{
MessageBox.Show("确认");
}
else if (f.DialogResult ==DialogResult .Cancel )
{
MessageBox.Show("取消");
}
else
{
MessageBox.Show("其他");
}
}