c#GridControl如何改變單元格的邊框顏色


在事件CustomDrawCell中添加

e.Cache.DrawRectangle(new Pen(Color.Red, 2), e.Bounds);

就可改變單元格邊框顏色。通過Pen的設置可以設置邊框顏色和邊框線的大小

下面是改變第一行第一列的單元格邊框顏色

private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
{
int columnIndex = e.Column.AbsoluteIndex;
int rowIndex = e.RowHandle;

if (columnIndex==0&&rowIndex==0)
{
e.Cache.DrawRectangle(new Pen(Color.Red, 2), e.Bounds);
}

}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM