첨부 소스 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170
using System;
using System.Drawing;
using System.Windows.Forms;

#region 텍스트 추가하기 - AppendText(richTextBox, text)

/// <summary>
/// 텍스트 추가하기
/// </summary>
/// <param name="richTextBox">RichTextBox</param>
/// <param name="text">텍스트</param>
public void AppendText(RichTextBox richTextBox, string text)
{
    richTextBox.AppendText(text);
}

#endregion

#region 텍스트 추가하기 - AppendText(richTextBox, text, textColor)

/// <summary>
/// 텍스트 추가하기
/// </summary>
/// <param name="richTextBox">RichTextBox</param>
/// <param name="text">텍스트</param>
/// <param name="textColor">텍스트 색상</param>
public void AppendText(RichTextBox richTextBox, string text, Color textColor)
{
    richTextBox.SelectionStart = this.richTextBox.TextLength;

    richTextBox.SelectionColor = Color.Green;

    richTextBox.SelectionStart = this.richTextBox.TextLength;

    richTextBox.SelectionColor = textColor;

    richTextBox.AppendText(text);

    richTextBox.SelectionStart = this.richTextBox.TextLength;

    richTextBox.SelectionColor = SystemColors.WindowText;
}

#endregion

#region 텍스트 추가하기 - AppendText(richTextBox, text, textColor, font)

/// <summary>
/// 텍스트 추가하기
/// </summary>
/// <param name="richTextBox">RichTextBox</param>
/// <param name="text">텍스트</param>
/// <param name="textColor">텍스트 색상</param>
/// <param name="font">폰트</param>
public void AppendText(RichTextBox richTextBox, string text, Color textColor, Font font)
{
    richTextBox.SelectionStart = this.richTextBox.TextLength;

    richTextBox.SelectionColor = Color.Green;

    richTextBox.SelectionStart = this.richTextBox.TextLength;

    richTextBox.SelectionColor = textColor;

    richTextBox.SelectionFont = font;

    richTextBox.AppendText(text);

    richTextBox.SelectionStart = this.richTextBox.TextLength;

    richTextBox.SelectionColor = SystemColors.WindowText;
}

#endregion
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요