반응형
텍스트 박스 안에 입력 한 내용에 대해서 Font Dialog를 이용해서 바꾸는 예제 입니다.
| FrmFontDialog.Designer.cs |
도구상자 - 대화상자 탭 - ColorDialog 와 FontDialog를 추가 합니다. ColorDialog - 색상관련 컨트롤 , FontDialog - 글자관련 컨트롤기능입니다.
|
| FrmFontDialog.cs |
| private void btnFont_Click(object sender, EventArgs e) { //폰트창을 열고 DialogResult dr = this.fdFont.ShowDialog(); //확인버튼 누르면 변경 if (dr == DialogResult.OK) { txtFont.Font = fdFont.Font; } } private void btnColor_Click(object sender, EventArgs e) { //색상창 열고 if (fdColor.ShowDialog() != DialogResult.Cancel) { txtFont.ForeColor = fdColor.Color; //글꼴색 변경 } } |
| 결과확인 |
반응형
'C#' 카테고리의 다른 글
| 13.C#_WinForm - 간단한 메모장 기능 구현 (0) | 2009.08.24 |
|---|---|
| 12.C#_WinForm - FolderBrowserDialog (0) | 2009.08.24 |
| 10.C#_WinForm - DialogResult (다른폼 값 넘기기) (2) | 2009.08.24 |
| 09.C#_WinForm - ComBoBox 와 ListBox (0) | 2009.08.24 |
| 08.C#_WinForm - GroupBox (0) | 2009.08.24 |
Comments