copy and save as an "Mxxx.txt" file and run from the MDI (or add a screen button as you require)
- Code: Select all
// ADD Button
Button button1 = new Button();
button1.Size = new System.Drawing.Size(110, 47);
button1.Location = new System.Drawing.Point(28, 149);
button1.Text = "Press me";
button1.Click += new EventHandler(button1_Click);
// ADD Label
Label label1 = new Label();
label1.Size = new System.Drawing.Size(57, 22);
label1.Location = new System.Drawing.Point(56, 93);
label1.AutoSize = true;
label1.Font = new System.Drawing.Font("Trebuchet MS", 12F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
label1.Text = "label1";
// ADD TextBox
TextBox textBox1 = new TextBox();
textBox1.Size = new System.Drawing.Size(82, 20);
textBox1.Location = new System.Drawing.Point(45, 123);
textBox1.Name = "textBox1";
// ADD PictureBox
PictureBox pictureBox1 = new PictureBox();
pictureBox1.Size = new System.Drawing.Size(112, 82);
pictureBox1.Location = new System.Drawing.Point(15, 12);
pictureBox1.ImageLocation = @"C:\UCCNC\Flashscreen\BMP\Defaultscreenset\aplus_down.png";
pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
// ADD RadioButton
RadioButton radioButton1 = new RadioButton();
radioButton1.Size = new System.Drawing.Size(85, 17);
radioButton1.Location = new System.Drawing.Point(6, 19);
radioButton1.AutoSize = true;
radioButton1.Checked = true;
radioButton1.Text = "radioButton1";
radioButton1.UseVisualStyleBackColor = true;
RadioButton radioButton2 = new RadioButton();
radioButton2.Size = new System.Drawing.Size(85, 17);
radioButton2.Location = new System.Drawing.Point(6, 46);
radioButton2.AutoSize = true;
radioButton2.Checked = false;
radioButton2.Text = "radioButton2";
radioButton2.UseVisualStyleBackColor = true;
// ADD GroupBox
GroupBox groupBox1 = new GroupBox();
groupBox1.Size = new System.Drawing.Size(122, 74);
groupBox1.Location = new System.Drawing.Point(155, 105);
groupBox1.Controls.Add(radioButton1);
groupBox1.Controls.Add(radioButton2);
groupBox1.Text = "groupBox1";
// ADD CheckBox
CheckBox checkBox1 = new CheckBox();
checkBox1.Size = new System.Drawing.Size(80, 17);
checkBox1.Location = new System.Drawing.Point(45, 202);
checkBox1.AutoSize = true;
checkBox1.Text = "checkBox1";
checkBox1.UseVisualStyleBackColor = true;
// ADD ComboBox
ComboBox comboBox1 = new ComboBox();
comboBox1.Size = new System.Drawing.Size(121, 21);
comboBox1.Location = new System.Drawing.Point(155, 202);
comboBox1.FormattingEnabled = true;
comboBox1.Items.AddRange(new object[] {
"Item1",
"Item2",
"Item3",
"Item4"});
// FORM
MyForm = new Form();
MyForm.Size = new System.Drawing.Size(300, 300); // Enter width & height of Form
MyForm.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
MyForm.Controls.Add(button1); // Add Button1
MyForm.Controls.Add(label1); // Add label1
MyForm.Controls.Add(textBox1); // Add textBox1
MyForm.Controls.Add(pictureBox1); // Add pictureBox1
MyForm.Controls.Add(groupBox1); // ADD groupBox1
//MyForm.Controls.Add(radioButton1); // ADD radioButton1 [not required if added to groupbox]
//MyForm.Controls.Add(radioButton2); // ADD radioButton2 [not required if added to groupbox]
MyForm.Controls.Add(checkBox1); // ADD checkBox1
MyForm.Controls.Add(comboBox1); // ADD comboBox1
MyForm.ShowDialog();
MyFunction();
#Events
Form MyForm; //This is a global variable, a Windows Form
void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("button1 was clicked!");
MyForm.Close();
}
void MyFunction()
{
exec.Code("G0 X10");
}