using (Pen p = new Pen(Color.GhostWhite)) { var iHalfWidth = (e.RowBounds.Left + sender.RowHeadersWidth) / 2; var oPointHLineStart = new Point(rect1.X + iHalfWidth, rect1.Y); var oPointHLineEnd = new Point(rect1.X + iHalfWidth, rect1.Y + rect1.Height / 2); e.Graphics.DrawLine(p, oPointHLineStart, oPointHLineEnd); //折叠线 e.Graphics.DrawLine(p, oPointHLineEnd, new Point(oPointHLineEnd.X + iHalfWidth, oPointHLineEnd.Y)); }
效果如下: