trying to make a pop up box with multiple buttons. (will be more than 2 when its completed)
so far it dispays the buttons and responds to clicks
however it runs both functions (of each button, not just the clicked button)
working from the pasted sample in documentation.
Button MyButton = new Button();
MyButton.Size = new System.Drawing.Size(80, 40);
MyButton.Location = new System.Drawing.Point(50, 130);
MyButton.Text = "button1";
MyButton.Click += new EventHandler(MyButton_Click);
Button MyButton2 = new Button();
MyButton2.Size = new System.Drawing.Size(80, 40);
MyButton2.Location = new System.Drawing.Point(200, 130);
MyButton2.Text = "button2";
MyButton2.Click += new EventHandler(MyButton2_Click);
MyForm = new Form();
MyForm.Size = new System.Drawing.Size(300, 300);
MyForm.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
MyForm.Controls.Add(MyButton);
MyForm.Controls.Add(MyButton2);
MyForm.ShowDialog();
MyFunction();
MyFunction2();
#Events
Form MyForm; //This is a global variable, a Windows Form
void MyButton_Click(object sender, EventArgs e)
{
MessageBox.Show("button1");
MyForm.Close();
}
void MyFunction()
{
exec.Code("G0 X10");
}
void MyButton2_Click(object sender, EventArgs e)
{
MessageBox.Show("button2 !");
MyForm.Close();
}
void MyFunction2()
{
exec.Code("G0 X20");
}