Příklad za tisíc slov :)
private void Form1_Load(object sender, EventArgs e)
{
Button[] btn = new Button[10];
for (int i = 0; i < 10; i++)
{
btn[i] = new Button();
btn[i].Text = i.ToString();
btn[i].Left = 10;
btn[i].Top = i * 25;
btn[i].Click += new EventHandler(ClickHandler);
btn[i].MouseMove += new MouseEventHandler(MouseMoveHandler);
Controls.Add(btn[i]);
}
}
public void ClickHandler(Object sender, EventArgs e)
{
MessageBox.Show(((Button)sender).Text);
}
public void MouseMoveHandler(Object sender, MouseEventArgs e)
{
this.Text = e.Y.ToString();
}