回复 4楼Alice的帖子
这样写了之后,确实可以通过e.Graphics.DrawRectangle用坐来画线了:
- private void fgGroupDetail_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
- {
- if ((e.Row >= this.fgGroupDetail.Rows.Fixed) & (e.Col ==(this.fgGroupDetail.Cols.Fixed - 1)))
- {
- e.Text = ((e.Row - this.fgGroupDetail.Rows.Fixed) + 1).ToString();
- }
- Pen bluePen = new Pen(Color.LightSkyBlue);
- bluePen.Width = 0.5F;
- if (e.Col<=8)
- {
- e.Graphics.DrawRectangle(bluePen, e.Bounds.X, e.Bounds.Y, 1, e.Bounds.Height);
- e.DrawCell(DrawCellFlags.All);
- }
- if(e.Col==10)
- {
- e.Graphics.DrawRectangle(bluePen, e.Bounds.X + e.Bounds.Width, e.Bounds.Y, 0, e.Bounds.Height);
- e.DrawCell(DrawCellFlags.All);
- }
- }
复制代码
但是还有问题没解决:
1. 双实线的问题
2. 用e.Graphics.DrawRectangle 时,线宽是整数,会覆盖 pen 的线宽设置 |