728x90
반응형
728x170
using System.Drawing;
using System.Windows.Forms;
#region 행 배경색 설정하기 - SetRowBackgroundColor(listView, oddRowColor, evenRowColor)
/// <summary>
/// 행 배경색 설정하기
/// </summary>
/// <param name="listView">ListView 객체</param>
/// <param name="oddRowColor">홀수 행 색상</param>
/// <param name="evenRowColor">짝수 행 색상</param>
public void SetRowBackgroundColor(ListView listView, Color oddRowColor, Color evenRowColor)
{
foreach(ListViewItem listViewItem in listView.Items)
{
if((listViewItem.Index % 2) == 0)
{
listViewItem.BackColor = evenRowColor;
}
else
{
listViewItem.BackColor = oddRowColor;
}
}
}
#endregion
728x90
반응형
그리드형(광고전용)
'C# > WinForm' 카테고리의 다른 글
[C#/WINFORM] 전체 화면 토글하기 (0) | 2014.12.02 |
---|---|
[C#/WINFORM] ImageConverter 클래스 : Image 구하기 (0) | 2014.12.02 |
[C#/WINFORM] ListBox 클래스 : 특정 행으로 스크롤하기 (0) | 2014.12.02 |
[C#/WINFORM] ListView 클래스 : 특정 행으로 스크롤하기 (0) | 2014.12.02 |
[C#/WINFORM] ListView 클래스 : 컬럼 헤더 클릭시 정렬하기 (0) | 2014.12.01 |
[C#/WINFORM] TextBox 클래스 : 마지막 문자로 스크롤하기 (0) | 2014.12.01 |
[C#/WINFORM] 색상 값 구하기 (0) | 2014.11.29 |
[C#/WINFORM] Form 클래스 : 애플리케이션 실행시 메인 폼을 바로 숨기기 (0) | 2014.03.11 |
[C#/WINFORM] 트레이 상단에 폼 위치 설정하기 (0) | 2012.10.22 |
[C#/WINFORM] Form 클래스 : CheckForIllegalCrossThreadCalls 정적 속성을 사용해 크로스 스레드(Cross-Thread) 예외 방지하기 (0) | 2012.10.07 |
댓글을 달아 주세요