日期:2014-05-18 浏览次数:21005 次
dataGridView1_RowPostPaint()中进行绘制
Rectangle rectangle2 = new Rectangle(e.RowBounds.Location.X - 50,
e.RowBounds.Location.Y,
dataGridView1.RowHeadersWidth - 4,
e.RowBounds.Height * 2);//这个地方把高度设置成为2行高,但是绘制出出来的字体显示一半,会被下面一行被遮住。
if(e.RowIndex%2==0)
{
TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(),
dataGridView1.RowHeadersDefaultCellStyle.Font,
rectangle,
dataGridView1.RowHeadersDefaultCellStyle.ForeColor,
TextFormatFlags.VerticalCenter | TextFormatFlags.Right);//问题应该是在e.Graphics个地方,只是在当前的层上来进行绘制,如何能跨两行上进行绘制?
}