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