C#
-
Timer 사용C#/WindowForm 2022. 4. 6. 11:17
실행코드 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace _29 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { label1.Location = new Point(Cli..
-
ComboBox를 사용한 학점 계산기C#/WindowForm 2022. 4. 6. 11:08
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApp2 { public partial class Form1 : Form { TextBox[] titles; ComboBox[] crds; ComboBox[] grds; public Form1() { InitializeComponent(); } private void Form1_Load(o..
-
ListBoxC#/WindowForm 2022. 4. 6. 11:03
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace _025_ListBox { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void listBox2_SelectedIndexChanged(object sender, EventArgs e) { ListBox ..
-
ComboBoxC#/WindowForm 2022. 4. 6. 10:55
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace _026_ComboBox { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { ComboB..
-
C# 라디오버튼과 그룹박스C#/WindowForm 2022. 3. 30. 03:22
namespace _019_RadioBT { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string result = ""; if (rb_Korea.Checked) //rb_Korea.Checked 체크되있으면 True값을 리턴 result += "국적 : 대한민국\n"; else if (rb_China.Checked) result += "국적 : 중국\n"; else if (rb_Japan.Checked) result += "국적 : 일본\n"; else if (rb_Others.Checked) result ..
-
C# 체크박스C#/WindowForm 2022. 3. 30. 02:52
namespace _019_CheckBox { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string checkStates = ""; CheckBox[] cBox = { checkBox1, checkBox2, checkBox3, checkBox4, checkBox5 }; foreach (var item in cBox) { checkStates += string.Format("{0} : {1}\n", //Format을 사용하여 문자열에 계속 추가 item.Text, item.Checked); } MessageB..
-
C# FlagC#/WindowForm 2022. 3. 30. 02:31
flag를 사용한 인사 namespace _018_flag { public partial class Form1 : Form { bool flag = true; //불타입 변수 public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { if (flag==true) { label1.Text = "Hello World"; flag = false; //flag를 false로 변환 } else { label1.Text = " "; flag = true; //flag를 true로 변환 } } } } 실행화면 실행화면
-
C# 윈도우 폼 메시지 박스C#/WindowForm 2022. 3. 30. 01:57
MessageBox.Show를 이용해 메시지 박스 만들기 public Form1() { InitializeComponent(); MessageBox.Show("메시지의 내용을 담는 곳.", "메시지 박스의 타이틀", MessageBoxButtons.YesNo/*메시지박의 버튼수*/, MessageBoxIcon.Exclamation/*메시지박의 형식*/); } private void button1_Click(object sender, EventArgs e) { DialogResult result1 = MessageBox.Show("두개의 버튼을 갖는 메시지박스입니다.","Question", MessageBoxButtons.YesNo); //result1에 댛화상자의 반환값을 저장 DialogResult r..