如何修改DataGridView某一列的边框样式
例如我想把DataGridView中的第4列的左边框网格线去掉,请高手指点,结案立即给分。
[解决办法]
思路和这个类似
http://blog.csdn.net/scutliu/article/details/5643288
[解决办法]
动态构—ataGridView动态加载列
其余的设计自己想怎么控制就怎么控制了
[解决办法]
http://forums.codeguru.com/showthread.php?415930-DataGridView-Merging-Cells
[解决办法]
CellPainting事件中,自己重绘单元格就可以了
[解决办法]
那不就是相当于合并第三列与第四列吗?
[解决办法]
if (e.RowIndex != -1 && e.ColumnIndex == 4)
{
Brush gridBrush = new SolidBrush(dataGridView1.GridColor);
using (Pen gridLinePen = new Pen(gridBrush))
{
e.Graphics.FillRectangle(new SolidBrush(Color.White), e.CellBounds);
e.Graphics.DrawLine(gridLinePen, e.CellBounds.Left,
e.CellBounds.Bottom - 1, e.CellBounds.Right,
e.CellBounds.Bottom - 1);
if (e.Value != null)
{
e.Graphics.DrawString((string)e.Value, e.CellStyle.Font, new SolidBrush(Color.Black), e.CellBounds.X + 2, e.CellBounds.Y + 5, StringFormat.GenericDefault);
}
}
e.Handled = true;
}
代码。。。
[解决办法]
看来LZ是伸手党,不知道是不会分析还是懒得分析,你那是一个icon,人家给的代码是DrawString,你改个方法不就行了吗