/// <summary> /// Draw a tint over everything in the ObjectListView except the /// row under the mouse. /// </summary> /// <param name="olv"></param> /// <param name="g"></param> /// <param name="r"></param> public override void Draw(ObjectListView olv, Graphics g, Rectangle r) { if (!r.Contains(olv.PointToClient(Cursor.Position))) { return; } Rectangle bounds = this.RowBounds; if (bounds.IsEmpty) { if (olv.View == View.Tile) { g.FillRectangle(this.FillBrush, r); } return; } using (Region newClip = new Region(r)) { bounds.Inflate(this.BoundsPadding); newClip.Exclude(this.GetRoundedRect(bounds, this.CornerRounding)); Region originalClip = g.Clip; g.Clip = newClip; g.FillRectangle(this.FillBrush, r); g.Clip = originalClip; } }
public override void Draw(ObjectListView olv, Graphics g, Rectangle r) { if (r.Contains(olv.PointToClient(Cursor.Position))) { using (Region region = new Region(r)) { Rectangle rowBounds = base.RowBounds; rowBounds.Inflate(base.BoundsPadding); region.Exclude(base.GetRoundedRect(rowBounds, base.CornerRounding)); Region clip = g.Clip; g.Clip = region; g.FillRectangle(base.FillBrush, r); g.Clip = clip; } } }
/// <summary> /// Draw a tint over everything in the ObjectListView except the /// row under the mouse. /// </summary> /// <param name="olv"></param> /// <param name="g"></param> /// <param name="r"></param> public override void Draw(ObjectListView olv, Graphics g, Rectangle r) { if (!r.Contains(olv.PointToClient(Cursor.Position))) return; Rectangle bounds = RowBounds; if (bounds.IsEmpty) { if (olv.View == View.Tile) g.FillRectangle(FillBrush, r); return; } using (var newClip = new Region(r)) { bounds.Inflate(BoundsPadding); newClip.Exclude(GetRoundedRect(bounds, CornerRounding)); Region originalClip = g.Clip; g.Clip = newClip; g.FillRectangle(FillBrush, r); g.Clip = originalClip; } }