-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
🚧 work in progressWork that is current in progressWork that is current in progressapi-approved(4) API was approved in API review, it can be implemented(4) API was approved in API review, it can be implementedarea-System.DrawingSystem.Drawing issuesSystem.Drawing issues
Milestone
Description
Background and motivation
In modern interfaces, rounded rectangles are used in many places instead of right-angled rectangles, such as github buttons and labels.
GDI has RoundRect, but GDI+ doesn't have a direct equivalent. We can, however, do the necessary path generation in GDI+ to implement this fairly common request.
The current Graphics class provides Graphics.DrawRectangle and Graphics.FillRectangle to support drawing rectangles, but currently there is no corresponding method for drawing rounded rectangles.
API Proposal
namespace System.Drawing;
public class Graphics
{
public void DrawRectangle(System.Drawing.Pen pen, System.DrawingRectangle rect);
// ...
+ public void DrawRoundedRectangle(System.Drawing.Pen pen, System.Drawing.Rectangle rect, Size corner);
+ public void DrawRoundedRectangle(System.Drawing.Pen pen, System.Drawing.RectangleF rect, SizeF corner);
+ public void FillRoundedRectangle(System.Drawing.Brush brush, System.Drawing.Rectangle rect, Size corner);
+ public void FillRoundedRectangle(System.Drawing.Brush brush, System.Drawing.RectangleF rect, SizeF corner);
}
namespace System.Drawing.Drawing2D;
public class GraphicsPath
{
public void AddRectangle(Rectangle rect);
// ...
+ public void AddRoundedRectangle(Rectangle rect, Size corner);
+ public void AddRoundedRectangle(RectangleF rect, SizeF corner);
}API Usage
graphics.DrawRoundedRectangle(new Pen(Color.Black), new Rectangle(0, 0, 100, 100), new Size(5, 5));
graphics.FillRoundedRectangle(new SolidBrush(Color.Black), new Rectangle(0, 0, 100, 100), new Size(5, 5));
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
🚧 work in progressWork that is current in progressWork that is current in progressapi-approved(4) API was approved in API review, it can be implemented(4) API was approved in API review, it can be implementedarea-System.DrawingSystem.Drawing issuesSystem.Drawing issues
