小编Ani*_*nil的帖子

DataGridView 的自定义单元格绘制的文本溢出

这是我的细胞绘画方法。

DataGridView grid = (DataGridView)sender;

if ( e.RowIndex == -1 || e.ColumnIndex == -1 )
{ return; }
if ( ( grid.Rows [ e.RowIndex ].Cells [ e.ColumnIndex ].Value == null ) )
    return;

Brush gridBrush = new SolidBrush(GridList[0].GridColor),backColorBrush = new SolidBrush(e.CellStyle.BackColor);
Pen gridLinePen = new Pen(gridBrush);

// Erase the cell.
e.Graphics.FillRectangle ( backColorBrush, e.CellBounds );

// Draw the grid lines (only the right and bottom lines;
// DataGridView takes care of the others).
e.Graphics.DrawLine ( gridLinePen, e.CellBounds.Left, e.CellBounds.Bottom - 1, …
Run Code Online (Sandbox Code Playgroud)

c# visual-studio winforms

5
推荐指数
1
解决办法
1885
查看次数

标签 统计

c# ×1

visual-studio ×1

winforms ×1