我检查时有一个单选按钮,它应该显示一条消息
DialogResult click = MessageBox.Show("Would you like to convert the actual values to US Customary ?\n Clicking No changes just the unit system.", "Change Unit Systems to US Customary", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
if (click == DialogResult.Yes)
{
//some code
}
如何从按钮中的内部代码答复此消息,否则为否?
DialogResult click = MessageBox.Show("Would you like to convert the actual values to US Customary ?\n Clicking No changes just the unit system.", "Change Unit Systems to US Customary", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
switch(click)
{
case DialogResult.Yes:
MessageBox.Show("Yes Clicked");
break;
case DialogResult.No:
MessageBox.Show("No Clicked");
break;
}