반응형
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Label label = new Label();
label.Text = "label";
label.Location = new Point(100,100);
label.Click += button2_Click;
Controls.Add(label);
}
private void button2_Click(object sender, EventArgs e)
{
Label label = sender as Label;
MessageBox.Show(label.Text);
}
}
반응형
'Programing > C#' 카테고리의 다른 글
c# 프로그래밍-키값 알아내기,KeyDown,KeyCode,Keys (0) | 2017.02.14 |
---|---|
c# 프로그래밍,마우스 클릭좌표 알아내기,mouse position,location,e.X ,e.Y (0) | 2017.02.12 |
c# , 다른 form 보이게 하고 데이타 전달,from data,show,폼이동 (0) | 2017.02.10 |
c# 충돌감지,처리,게임,IntersectsWith,Bounds,game (0) | 2017.02.08 |
C# 랜덤, random 함수,Next (0) | 2017.02.08 |