Blog Content

  • 30.C#_WinForm - 폼 클로우징 이벤트 (C# Closing Event)

    Category C# on 2009. 9. 2. 15:15

    폼 클로우징 이벤트로 해당 폼을 닫을 때 한번 더 확인여부를 묻는메세지박스를 띄우는 예제입니다. FrmMain FrmMain 이벤트 속성 동작 - FormClosing : 폼을 닫을때 또는 폼 닫기 전에 발생하는 이벤트 FrmMain.cs private void FrmMain_FormClosing(object sender, FormClosingEventArgs e){ //폼을 닫을건지 취소 할 것인지 결정 DialogResult dr = MessageBox.Show("종료하시겠습니까?", "종료확인", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dr == DialogResult.No) { e.Cancel = true; //취소 }} 결과확인

    Read more
  • 29.C#_WinForm - C# MouseMove, C# MouseDown 이벤트

    Category C# on 2009. 9. 2. 14:38

    C# Mouse 이벤트를 이용하여 C#폼에서 그림을 그리는 예제입니다.마우스 왼쪽 클릭시 선 그리기, 마우스 오른족 클릭시 원 그리기 메뉴추가 : FrmMain - 샘플 -MouseMove, MouseDown FrmMouseEvent 속성 마우스- MouseDown : 마우스 포인터가 구성요소위에 있을 때 이벤트- MouseMove : 마우스 포인터를 구성요소위로 이동 할 때 이벤트모양 - Print : 컨트롤을 다시 그릴 때 발생하는 이벤트 FrmMouseEvent.cs using System.Collections; //네임스페이스 추가namespace WinFrmMain.Sample{ public partial class FrmMouseEvent : Form { private ArrayList al;..

    Read more
  • 28.C#_WinForm - 키 다운 이벤트 ( KeyDown Event)

    Category C# on 2009. 9. 2. 13:34

    키보드에서 입력 방향으로 원 그림이 움직이는 간단한 예제입니다. 메뉴추가 : FrmMain - 샘플 - 키 다운 이벤트 FrmKeyDown 이벤트 속성 FrmKeyDown폼에 대해서 이벤트 속성탭에서 이벤트를 추가합니다. 모양 - Paint 이벤트 : 컨트롤을 다시 그려야 할 때 발생하는 이벤트 키 - KeyDown 이벤트 : 키를 처음 누를때 발생하는 이벤트 FrmKeyDown.cs public partial class FrmKeyDown : Form { private Point p; //포인트 선언 public FrmKeyDown() { InitializeComponent(); p.X = 10; p.Y = 10; } //폼에서 키보드가 입력 될 때 private void FrmKeyDown_KeyDo..

    Read more
  • 91.C# - 스레드(Thread) 와 프로세스(Process)

    Category C# on 2009. 9. 2. 12:59

    스레드(Thread) : 프로세스 안에서 실행하는 단위 프로그램(메서드), 멀티 스래딩 환경(랜덤/가중치에 따라 운영체제에 따라 실행) 스레드 영역에 스레드 올림. 실행순서 중요하지 않을 때 사용프로세스(Process) : 하나의 프로그램 단위(프로젝트)로 실행중인 응용프로그램을 의미 Program.cs static void Main(string[] args) { //Win(); Sql(); Ide(); // 단일 스레드 : 순차적으로 실행 // 멀티 스래딩. ThreadStart 대리자 ThreadStart ts1 = new ThreadStart(Win); ThreadStart ts2 = new ThreadStart(Sql); Thread t1 = new Thread(ts1); Thread t2 = n..

    Read more
  • 90.C# - 전역어셈블리캐시 ( Assembly )

    Category C# on 2009. 9. 2. 09:00

    어셈블리는 전용과 공유 두가지로 분리됩니다.전용 : 자신만이 사용하는 어셈블리어, DLL파일이 프로젝트에 복사됨공유 : 여러 사람들이 사용 가능한 어셈블리어로 C:\Windows\assembly 폴더에 DLL파일을 추가 하여 사용 , 참조만 하고 복사되지 않음 전역(공유)어셈블리캐시 예제입니다. 27.C#_WinForm - DLL 파일만들기와 같은 방법으로 DLL을 생성합니다.(링크) Watch.DLL 만들기 1. 새프로젝트 - 빈 솔루션 생성 후 2. 빈 솔루션 - 추가 - 새프로젝트 - C# - Windows - 클래스 라이브러리 추가 (이름 : Watch) 3. 추가한 Watch에서 'program.cs' 파일을 삭제 후 Watch에서 클래스 추가 (이름 : Clock) Clock.cs namesp..

    Read more
  • 27.C#_WinForm - DLL 파일 만들기

    Category C# on 2009. 9. 1. 19:30

    C# DLL 만드는 간단한 예제입니다.DLL파일을 만드는 이유는 자주 사용되는 로직을 DLL 파일로 작성하여코드를 불러와 재사용 하는 것입니다.예제에서는 더하는 DLL을 만듭니다. DLL 제작 새 프로젝트 - 기타 프로젝트 형식 - Visual Studio 솔루션 - 빈 솔루션 선택 솔루션 탐색기에서 생성한 빈 솔루션에 '새 프로젝트'를 추가 합니다. C# - Windows - 클래스 라이브러리 추가 (이름:Calculator) 추가 하면 생성한 클래스 라이브러리에 Class.cs 파일이 있습니다. 파일의 이름을 변경합니다. "CalculatorPlus" 이는 쉽게 구분 하기 위함입니다. CalculatorPlus.cs public class CalculatorPlus { public static int..

    Read more
  • 26.C#_WinForm - 드래그 앤 드롭 ( Drag And Drop )

    Category C# on 2009. 8. 31. 23:07

    메모장 안에 택스트 파일을 드래그앤 드롭 시 택스트 파일이 자동으로 열리는 예제 입니다. FrmMain - 샘플 - 간단한메모장 FrmSampleNotepad 속성을 지정 하도록 합니다. txtNote 컨트롤 : 속성 - AllowDrop = True로 설정합니다. 컨트롤에 데이터를 끌어 놓을 수 있는지의 여부에 대해서 설정 txtNote 컨트롤 이벤트 속성 지정 이벤트 핸들러를 추가합니다. txtNote_DragDrop 부분 코드 작성 private void txtNote_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { if (e.Data.GetDataPresent(DataFormat..

    Read more
  • 25.C#_WinForm - 인쇄 미리보기 ( Print Preview )

    Category C# on 2009. 8. 31. 22:03

    C# 인쇄 미리보기 예제입니다.24장 간단한 메모장에서 추가 하겠습니다. FrmMain - 샘플 - 간단한메모장 FrmSampleNotepad.Designer.cs private System.Windows.Forms.Button btnPrintView; private System.Drawing.Printing.PrintDocument printDocument; private System.Windows.Forms.PrintPreviewDialogprint PreviewDialog; FrmSampleNotepad.cs using System.Drawing.Drawing2D; //네임스페이스 추가 private void btnPrintView_Click(object sender, EventArgs e) { t..

    Read more
  • 24.C#_WinForm - Copy & Paste ( 복사, 붙여넣기 )

    Category C# on 2009. 8. 31. 20:25

    13장 간단한메모장 예제에서 복사,붙여넣기 기능을 추가 합니다. C# 클립보드를 이용한 복사 붙여넣기 예제 입니다. FrmMain - 샘플 - 간단한메모장 FrmSampleNotepad.Designer.cs private System.Windows.Forms.Button btnCopy; private System.Windows.Forms.Button btnPaste; btnCopy, btnPaste 버튼 이벤트 컨트롤 설정 - Click에 공통 이벤트 컨트롤을 추가 시켜줍니다. FrmSampleNotepad.cs private void btnClick(object sender, EventArgs e) { Button btn = sender as Button; if (btn == btnCopy) //복사 ..

    Read more
  • 23.C#_WinForm - 툴 팁 ( ToolTip )

    Category C# on 2009. 8. 31. 19:16

    ToolTip 란 풍선말로 특정영역에 마우스를 이동했을때 나타나는 예제입니다. 메뉴추가 : FrmMain - 공용컨트롤- 툴 팁 FrmToolTip.Designer.cs private System.Windows.Forms.ToolTip toolTip; private System.Windows.Forms.Button button1; Botton 속성 결과확인

    Read more
  • 22.C#_WinForm - 탭 컨트롤 -2 ( Tab Control )

    Category C# on 2009. 8. 31. 16:15

    탭 컨트롤(Tab Control) 과 파일 정보 레지스트리에 추가 하는 예제입니다. FrmMain - 컨테이너 - 탭 컨트롤 ( 이어서 작성 ) FrmTabControl.Designer.cs TrackBar 속성 Orientation - Vaertical 설정 , Maximum - 2 설정 private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Label lblDisplay; private System.Windows.Forms.TrackBar tBLevel; TrackBar - 이벤트 - Scroll : 이벤트 핸들러 추가 합니다. FrmTabControl.cs private void tBLevel_Scroll(objec..

    Read more
  • 22.C#_WinForm - 탭 컨트롤 -1 ( Tab Control )

    Category C# on 2009. 8. 31. 13:11

    탭 컨트롤(Tab Control) 과 파일 정보 레지스트리에 추가 하는 예제입니다. 메뉴추가 : FrmMain - 컨테이너 - 탭 컨트롤 FrmTabControl.Designer.cs TabControl 속성 - TabPages에서 컬렉션을 설정합니다. 맴버를 추가 하게 되면 탭 페이지가 늘어납니다. [0]tabPage1 = Name : TabHome , Text : 일반 -> tabHome [1]tabPage2 = Name : TabLevel , Text : 보안 -> tabLevel private System.Windows.Forms.TabControl tabControl; private System.Windows.Forms.TabPage tabHome; private System.Windows.Fo..

    Read more
  • 22.C#_WinForm - 윈도우탐색기

    Category C# on 2009. 8. 28. 18:03

    TreeView와 ListView 컨트롤을 이용하여 간단한 윈도움 탐색기 예제입니다. 메뉴추가 : FrmMain - 공용컨트롤 - 간단한 윈도우탐색기 WinExplorer.Designer.cs private System.Windows.Forms.ListView listView; private System.Windows.Forms.TreeView treeView; ListView 속성 ListView속성 - Columns 설정ListView속성 - View - Details 설정 TreeView 속성 추가한 TreeView 컨트롤 이벤트를 설정합니다. WinExplorer.cs using System.IO; //추가 파일관련 - 참조파일에서 추가 System.IO using System.Management..

    Read more
  • 21.C#_WinForm - TreeView

    Category C# on 2009. 8. 28. 16:25

    TreeView 컨트롤을 이용한 간단한 예제입니다. 메뉴추가 : FrmMain - 공용컨트롤 - 트리뷰 FrmTreeView.Designer.cs private System.Windows.Forms.TreeView treeView; treeView 속성 treeView - 속성 - Node 컬랙션 선택 : 컨트롤 도구 상자를 이용해 노드를 추가합니다. *추가한 노드에 대해서 Text 명을 입력합니다. 결과확인

    Read more
  • 20.C#_WinForm - ListView

    Category C# on 2009. 8. 28. 16:01

    ListView 컨트롤을 이용한 예제입니다. ListView 컨트롤을 이용하여 국어,영어와 총 점수를 출력하도록 하겠습니다. FrmListView.cs private System.Windows.Forms.ListView lstView; private System.Windows.Forms.ColumnHeader colKor; private System.Windows.Forms.ColumnHeader colEng; private System.Windows.Forms.ColumnHeader colTot; ListView 속성 맴버 0 -> Text : 국어, Name colKor 맴버 1 -> Text : 영어, Name colEng 맴버 2 -> Text : 총점, Name colTot FrmListView..

    Read more
1 2 3 4 5 ··· 11