안녕하세요 메시어스 입니다.
일반 셀에만 아래쪽 보더만 변경하려면 OwnerDrawCell 이벤트를 사용해서 셀 아래쪽에 보더를 커스터마이즈 할 수 있습니다.
간단한 코드와 샘플 프로젝트를 전달 드립니다.
readonly int _borderWeight = 1;
readonly Color _borderColor = Color.Black;
public Form1()
{
InitializeComponent();
#region c1flexgrid1 - equal borders in both fixed and normal cells
c1FlexGrid1.Styles.Normal.Border.Color = c1FlexGrid1.Styles.Fixed.Border.Color;
#endregion
#region c1flexgrid2 - extra bold bottom-border in normal cells
//handle the OwnerDrawCell event for drawing bold borders
c1FlexGrid2.DrawMode = DrawModeEnum.OwnerDraw;
c1FlexGrid2.OwnerDrawCell += C1FlexGrid2_OwnerDrawCell;
}
private void C1FlexGrid2_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
{
//if event is fired only for measuring, return
if (e.Measuring) return;
//draw the cell background, border and content
e.DrawCell(DrawCellFlags.All);
e.Handled = true;
//manually draw bold bottom-border
if(e.Col == 1 && e.Row >= c1FlexGrid2.Rows.Fixed)
{
var rect = new Rectangle(e.Bounds.X, e.Bounds.Bottom - _borderWeight, e.Bounds.Width, _borderWeight);
e.Graphics.FillRectangle(new SolidBrush(_borderColor), rect);
}
}
감사합니다.
메시어스 드림