【发布时间】:2013-05-17 09:35:23
【问题描述】:
我有一个带有几列自定义绘制边框的网格。但是,当我们将自定义绘制的边框与普通(非自定义)列进行比较时,它会稍微厚一些。因此,如果我们应用背景颜色,将像第 2 行第 1 列一样填充整个单元格。有没有办法消除这种厚度,以便自定义和非自定义单元格看起来相似。
块引用
代码如下:
private void uxGrid_CustomDrawCell(object sender, RowcellCustomDrawEventArgs e)
{
if(col==1)
{
DrawCellBorder(b,e.bounds);
}
}
private void DrawCellBorder(RowCellCustomDrawEventArgs e, int top, int left, int right, int bottom)
{
Brush b = Brushes.Red;
if(top ==1)
e.Graphics.Fillrectangle(b, new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bound.Width,1));
if(right ==1)
e.Graphics.Fillrectangle(b, new Rectangle(e.Bounds.X.Right, e.Bounds.Y, 1, e.Bound.Height));
if(bottom ==1)
e.Graphics.Fillrectangle(b, new Rectangle(e.Bounds.X, e.Bounds.Bottom, e.Bound.Width,1));
if(left ==1)
e.Graphics.Fillrectangle(b, new Rectangle(e.Bounds.X, e.Bounds.Y, 1, e.Bounds.Height));
}
【问题讨论】:
-
我相信这个问题的原因在于您的“自定义绘图”代码。您能否将此代码附加到原始问题中?
标签: devexpress xtragrid