using System; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; namespace FormWithButton { public class Form1 : Form { public Button button1; public Form1() { int xCo = 10; //read how many time the loop should execute in the ini or xml file; for (int i = 0; i < 3; i++) { button1 = new Button(); button1.Size = new Size(40, 40);
xCo += 50;
button1.Location = new Point(xCo, 30);
//read the Text-key in the ini or xml file;
button1.Text = "Text";
this.Controls.Add(button1);
//read what progress should be executed in and pass it on to the eventhandler?;
button1.Click += new EventHandler(button1_Click);
}
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("Event Triggerd");
//start the corrent procces;
System.Diagnostics.Process.Start("notepad.exe");
}
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new Form1());
}
}
}
|