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

private DataGridView dataGridView;

...

#region DataGridView 셀 포맷하기 - dataGridView_CellFormatting(sender, e)

/// <summary>
/// DataGridView 셀 포맷하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void dataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
    if(e.ColumnIndex == 1)
    {
        if(e.Value != null)
        {
            string text = e.Value.ToString();

            if(text.Contains("Bike"))
            {
                e.CellStyle.ForeColor          = Color.Red;
                e.CellStyle.SelectionForeColor = Color.Red;
            }
        }
    }
}

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

댓글을 달아 주세요