C# richbox에서 버튼누를때 글자색 변경하도록 하는 방법
C#/Tip :
2009. 8. 8. 10:34
richbox에서 버튼누를때 글자색 변경하도록 하는 방법
private void richTextBox1_KeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.NumPad1:
case Keys.D1:
richTextBox1.SelectionStart = richTextBox1.Text.Length;
richTextBox1.SelectionLength = 1;
richTextBox1.SelectionColor = Color.Red;
break;
case Keys.NumPad2:
case Keys.D2:
richTextBox1.SelectionStart = richTextBox1.Text.Length;
richTextBox1.SelectionLength = 1;
richTextBox1.SelectionColor = Color.Yellow;
break;
case Keys.NumPad3:
case Keys.D3:
richTextBox1.SelectionStart = richTextBox1.Text.Length;
richTextBox1.SelectionLength = 1;
richTextBox1.SelectionColor = Color.Blue;
break;
default:
richTextBox1.SelectionStart = richTextBox1.Text.Length;
richTextBox1.SelectionLength = 1;
richTextBox1.SelectionColor = Color.Black;
break;
}
}
- 개발자 커뮤니티 사이트 (http://www.sky.ph) -'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 |


