在事件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);
}
}