如何使MessageBoxButton移动?

时间:2014-05-06 18:49:34

标签: c#

我制作了一个TextBox,用于保留您键入的内容,当您点击相关按钮时,它会为您提供一个消息框。当人们想要点击“否”时,我希望按钮更改位置,以便人们无法点击它以便他们被迫单击“是”。你能帮助我吗?这是代码:

{

 MsgBox = new CustomMsgBox();
 MsgBox.label1.Text = Text;
 MsgBox.button1.Text = btnOK;
 MsgBox.button2.Text = btnCancel;
 MsgBox.Text = Caption;
 result = DialogResult.No;
 MsgBox.ShowDialog();
 return result;

}

    private void button2_Click(object sender, EventArgs e)
    {
        button2.Location = new Point(25, 25);
    }
    private void button2_MouseHover(object sender, EventArgs e)
    {

        button2.Location = new Point(+50, +50);
    }
    private void button2_MouseLeave(object sender, EventArgs e)
    {

        button2.Location = new Point(+100, +100);
    }

1 个答案:

答案 0 :(得分:4)

您需要创建自己的表单并使其像消息框一样工作。您将实例化自己的表单,而不是创建MessageBox,以便您可以处理它上面的按钮。