C# richbox에서 버튼누를때 글자색 변경하도록 하는 방법
C#/Tip :
2009. 8. 8. 10:34
richbox에서 버튼누를때 글자색 변경하도록 하는 방법
- 개발자 커뮤니티 사이트 (http://www.sky.ph) -
01 | private void richTextBox1_KeyDown( object sender, KeyEventArgs e) |
02 | { |
03 | switch (e.KeyCode) |
04 | { |
05 | case Keys.NumPad1: |
06 | case Keys.D1: |
07 | richTextBox1.SelectionStart = richTextBox1.Text.Length; |
08 | richTextBox1.SelectionLength = 1; |
09 | richTextBox1.SelectionColor = Color.Red; |
10 | break ; |
11 | case Keys.NumPad2: |
12 | case Keys.D2: |
13 | richTextBox1.SelectionStart = richTextBox1.Text.Length; |
14 | richTextBox1.SelectionLength = 1; |
15 | richTextBox1.SelectionColor = Color.Yellow; |
16 | break ; |
17 | case Keys.NumPad3: |
18 | case Keys.D3: |
19 | richTextBox1.SelectionStart = richTextBox1.Text.Length; |
20 | richTextBox1.SelectionLength = 1; |
21 | richTextBox1.SelectionColor = Color.Blue; |
22 | break ; |
23 | default : |
24 | richTextBox1.SelectionStart = richTextBox1.Text.Length; |
25 | richTextBox1.SelectionLength = 1; |
26 | richTextBox1.SelectionColor = Color.Black; |
27 | break ; |
28 | } |
29 | } |
'C# > Tip' 카테고리의 다른 글
C# 자식창에서 부모창으로 값넘기기 (0) | 2009.08.12 |
---|---|
C# 컨트롤을 마우스로 드래그로 이동할때 (2) | 2009.08.08 |
C# Access 데이터베이스, 테이블, 칼럼 생성 방법 (0) | 2009.08.07 |
C# Listview 에서 칼럼헤드 클릭시 정렬 되게 하는.. (0) | 2009.08.07 |
C# 문자열 크기를 바이트크기로 (0) | 2009.08.07 |