반응형 Programing/C#13 c# 프로그래밍,마우스 클릭좌표 알아내기,mouse position,location,e.X ,e.Y private void Form1_MouseDown(object sender, MouseEventArgs e) { label1.Text = e.X + ":" + e.Y; } 2017. 2. 12. c# , 다른 form 보이게 하고 데이타 전달,from data,show,폼이동 public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Form2 aa = new Form2(); aa.Show(); aa.SetData(label1.Text); // form 2의 메소드로 데이타 전송한다. } } public partial class Form2 : Form { public Form2() { InitializeComponent(); } public void SetData(String Data) { label1.Text = Data; // form 1 에서 받아온값을 label1.Text 입력 } }} 2017. 2. 10. c#,이벤트 공유,콘트롤동적생성,Controls.Add,event 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); } } 2017. 2. 10. c# 충돌감지,처리,게임,IntersectsWith,Bounds,game if ((pictureBox1.Bounds.IntersectsWith(button1.Bounds)) || (pictureBox2.Bounds.IntersectsWith(button1.Bounds) ) || (pictureBox3.Bounds.IntersectsWith(button1.Bounds) )) { timer1.Stop(); timer2.Stop(); MessageBox.Show("게임끝"); } 2017. 2. 8. 이전 1 2 3 4 다음 반응형