C# 确认信息
如果用户选中C# 确认信息,c#,winforms,messagebox,C#,Winforms,Messagebox,如果用户选中复选框,我如何编码以显示消息框。显示(“…”),在消息框中使用yes取消按钮,当用户单击否时,会弹出另一个MessageBox.show 到目前为止,我的代码是这样的,它无法工作: private void lipsCheckBox_CheckedChanged(object sender, EventArgs e) { if (lipsCheckBox.Checked = MessageBox.Show("...?", "Want s
复选框
,我如何编码以显示消息框。显示(“…”
),在消息框中使用yes取消
按钮,当用户单击否时,会弹出另一个MessageBox.show
到目前为止,我的代码是这样的,它无法工作:
private void lipsCheckBox_CheckedChanged(object sender, EventArgs e)
{
if (lipsCheckBox.Checked = MessageBox.Show("...?",
"Want something else?",
MessageBoxButtons.YesNoCancel, MessageBox.Show("...?",
"Yea, Burt's bees?",
MessageBoxButtons.YesNoCancel, MessageBox.Show("...??",
"Hell yea LipxMedx?",
MessageBoxButtons.YesNoCancel),
MessageBoxIcon.Question);
}
这样做:
if (checkBox1.Checked)
{
DialogResult dr = MessageBox.Show("Message.", "Title", MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Information);
if (dr == DialogResult.Yes)
{
// Do something
}
}
您应该能够使用此代码段完成所需的其余部分。执行以下操作:
if (checkBox1.Checked)
{
DialogResult dr = MessageBox.Show("Message.", "Title", MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Information);
if (dr == DialogResult.Yes)
{
// Do something
}
}
您应该能够使用此代码段完成所需的其余部分。您可以按如下方式完成:
private void lipsCheckBox_CheckedChanged(object sender, EventArgs e)
{
if (lipsCheckBox.Checked)
{
DialogResult dr = MessageBox.Show("...?", "Want something else?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);
if(dr == DialogResult.Yes)
{
//
}
else if(dr == DialogResult.Cancel)
{
//
}
}
}
您可以按如下方式进行操作:
private void lipsCheckBox_CheckedChanged(object sender, EventArgs e)
{
if (lipsCheckBox.Checked)
{
DialogResult dr = MessageBox.Show("...?", "Want something else?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);
if(dr == DialogResult.Yes)
{
//
}
else if(dr == DialogResult.Cancel)
{
//
}
}
}
你一定知道这件事
你一定知道这件事
你是在问如何制作一个基本的if语句吗?这无法编译…我甚至不理解你粘贴在这里的内容。即使从伪代码的角度来看,这也毫无意义。显示第一个消息框和
if(他们单击了否)
显示另一个。换句话说,如何处理我的if语句,就像用户单击我的复选框一样,然后会出现一个MessageBox问我一个问题,该MessageBox应该有YesNoCancel按钮,如果用户单击no,另一个MessageBox应该会出现询问另一个问题的相同格式,(YesNoCancel)按钮,如果用户单击“否”,则会有另一个消息框询问另一个问题。但是如果用户在第二个问题(第一个问题)之前单击“是”,那么第二个当然不会显示。你是在问如何生成基本的if语句吗?这无法编译…我甚至不理解你粘贴在这里的内容。即使从伪代码的角度来看,这也毫无意义。显示第一个消息框和if(他们单击否)
显示另一个。换句话说,如何处理我的if语句,就像用户单击我的复选框一样,然后会出现一个MessageBox问我一个问题,该MessageBox应该有YesNoCancel按钮,如果用户单击no,另一个MessageBox应该会出现询问另一个问题的相同格式,(YesNoCancel)按钮,如果用户单击“否”,则会有另一个消息框询问另一个问题。但是如果用户在第二个问题(第一个问题)之前单击“是”,则第二个问题当然不会显示。