본문 바로가기

분류 전체보기246

WinForms DataGridView DataGridView 간단한 실습 예제 public partial class Form1 : Form { List aList; public Form1() { InitializeComponent(); aList = new List { new Cafe() { Name = "아메리카노", Price = 1500 }, new Cafe() { Name = "라떼는 말야", Price = 3000 }, new Cafe() { Name = "녹차 프라푸치노", Price = 3500 }, new Cafe() { Name = "아아메리카노", Price = 2000 }, new Cafe() { Name = "에스프레소", Price = 1500 } }; dataGridView1.DataSource = aList; } .. 2021. 6. 11.
Window Forms 리스트 박스 ,콤보 박스 데이터를 묶어서 관리할 수 있다. 콤보박스 입력 방법 List aList1 = new List(); public Form1() { InitializeComponent(); aList1.Add("감자"); aList1.Add("고구마"); aList1.Add("사과"); //comboBox 는 List 클래스를 지원함 comboBox1.DataSource = aList1; } 콤보 박스는 List 클래스를 지원한다. private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e) { // MessageBox.Show((((ComboBox)sender).SelectedIndex).ToString()); //선택된 객체의 인덱스 Messa.. 2021. 6. 11.
예외처리 예외 처리 try,catch using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { static void Main(string[] args) { int iNumer; Console.Write("정수를 입력하세요: "); try // 예외 발생을 감시하는 구간 { iNumer = int.Parse(Console.ReadLine()); // 위코드에서 잘못된 입력시 프로그램을 중지하고, // 닷넷 프레임워크에서 예외 객체를 생성한다. // 생성된 예외 객체는 catch 문에 던져 준다. // 지금의 경우 FormatExceptio.. 2021. 6. 10.
enum 열거형 다중지정 방식 Flasgs 클래스를 사용하면 열거형을 하나의 변수에 다중 지정 할 수있다. using System; [Flags] public enum DinnerItems { None = 0, Entree = 1, Appetizer = 2, Side = 4, Dessert = 8, Beverage = 16, BarBeverage = 32 } public class Example { public static void Main() { DinnerItems myOrder = DinnerItems.Appetizer | DinnerItems.Entree | DinnerItems.Beverage | DinnerItems.Dessert; DinnerItems flagValue = DinnerItems.Entree | Dinner.. 2021. 6. 10.
c 언어 공부 추천 블로그 https://modoocode.com/231 씹어먹는 C 언어 시작하기 modoocode.com c 언어에서 사용되는 함수 별로 정리 잘되어 있음 2021. 6. 9.
210608 이벤트의 object sender, EventArgs e 매개 변수에 대해서 private void button1_Click(object sender, EventArgs e) { } e 는 이벤트에 대한 정보가 담겨 있는 객체이다. sender 는 이벤트가 일어나는 추체로 지금은 button 이다. private void button1_Click(object sender, EventArgs e) { Button aButton; aButton = sender as Button; aButton.Text = "지옥으로 키티 "; } 와 같이 직접적으로 버튼을 다룰 수 있다. CheckBox using System; using System.Collections.Generic; using System.Compon.. 2021. 6. 8.
소코반게임 만들기 배운점 1. 스트링은 readonly 속성으로 수정이 불가능하다. 2. paint이벤트의 의 draw 기능은 함수 내에서 바로 구현 되지 않고 윈도우에 요청만 한 상태이다. 함수가 끝나고 나서야 그려진다. 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 Socoban_Game { public partial class Form1 : Form { Bitmap a.. 2021. 6. 8.
랜덤 액세스 :fseek(),ftell() fseek() int fseek(FILE *fp, long offse , int whence); fp : 대상이 되는 파일 포인터 offset: whence 위치부터 새로운 위치까지 상대적으로 떨어진 거리(바이트수) whence: 파일 포인터 이동을 위한 기준점 출처https://modoocode.com/72 C 언어 레퍼런스 - fseek 함수 modoocode.com 학생 socre 를 입력 받아서 저장하고 출력 하는 코드 #include int add(); int search(); typedef struct score { int eng, math; char name[20]; } STUCENT_SCORE; char* fname = "result.dat"; int main() { int stop = 0.. 2021. 6. 7.
210607 1.리소스 사용하기 리소스 스트링 추가 HELLOW 안에 지옥으로 키티 들어있다. 2 . 이미지 리소스 활용해서 이미지 이동하기 (경계검사포함) 1. 이미지를 리소스에 먼저 등록 2. form1 의 paint 이벤트 생성 3. 코드 작성 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 _210607_006 { public partial class Form1 .. 2021. 6. 7.