Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 winform 上,有没有办法使用 DrawRectangle 方法或解决方法来绘制这样的矩形(没有顶部)?
您可以尝试使用以下SetClip方法:
SetClip
private void DrawTopless(Graphics g, Rectangle r) { g.SetClip(new Rectangle(r.Left, r.Top, r.Width + 1, 10), CombineMode.Exclude); g.DrawRectangle(Pens.Red, r); g.ResetClip(); }