IT 개발

[C#] Component One (C1) FlexGrid Cell Style (색깔 등) 정하기

쭈니루 2014. 3. 5. 09:00
반응형

 C1 FlexGrid Cell Style 정하기


Component One FlexGrid Cell Style 설정하는 방법을 알아보겠습니다.

 

이 기능을 사용하기 위해서는 페이지 젤 상단에
using C1.Win.C1FlexGrid; <= 요거 있어야 한다는 건 다 아시죠?


아래와 같은 Gird가 있다고 예를 들겠습니다.

 

 

Grid의 Cell을 변경하시고자 하는 Function에 아래와 같이 선언을 해 줍니다.

 

 

CellStyle csCellStyle = c1FlexGrid1.Styles.Add("CellStyle");
csCellStyle.Border.Color = Color.DarkGray;                  // Grid의 테두리 색
csCellStyle.BackColor = Color.LightPink;                    // Cell의 바탕색
csCellStyle.Font =  new Font(Font, FontStyle.Bold);           // 글자 굵기 굴게

 

 

그리고 나서, 단일 Cell 단위로 Cell Style을 변경하고 싶은 경우는 아래처럼 구현합니다.

 

 

c1FlexGrid1.SetCellStyle(2, 1, csCellStyle);

 

 

 

여러 Cell에 대해 동시에 적용하고 싶은 경우는 아래와 같이 구현하시면 됩니다.

 

 

CellRange crCellRange = c1FlexGrid1.GetCellRange(2,1,3,2);       // 적용할 Cell의 영역 설정
crCellRange.Style = c1FlexGrid1.Styles["CellStyle"];              // 설정된 Cell 영역에 Style 적용

 

 

 

간단하죠? ㅎㅎ

 

 

반응형