button 1 private void button 1Clickobject sender Event
이벤트 처리 함수 // button 1이 클릭될 때 발생하는 이벤트처리함수 private void button 1_Click(object sender, Event. Args e) { if (text. Box 1. Text == "의료IT" && text. Box 2. Text == "1234") { label 3. Text = "성공했습니다"; } else { label 3. Text = "실패했습니다"; } }
2주차 1일 3. 7(화) Form : Login – Close() WPF : Hello. World / BMI계산기
배경색과 글자색을 Toggle private void label 1_Click(object sender, Event. Args e) { if (label 1. Fore. Color != Color. White) { label 1. Fore. Color = Color. White; this. Back. Color = Color. Black; } else { label 1. Fore. Color = Form. Default. Fore. Color; this. Back. Color = Form. Default. Back. Color; } }
2. WPF Hello. World <Grid> <Label Name="label 1" Horizontal. Alignment="Center" Vertical. Alignment="Center" Font. Size="30" Font. Weight="Bold" Mouse. Down="Label_Mouse. Down">Hello World!</Label> </Grid> private void label 1_Click(object sender, Event. Args e) { if (label 1. Fore. Color != Color. White) { label 1. Fore. Color = Color. White; this. Back. Color = Color. Black; } else { label 1. Fore. Color = Label. Default. Fore. Color; this. Back. Color = Form. Default. Back. Color; } }
- Slides: 21