Drawing Rounded Rectangles?

  • Thread starter Thread starter Craig Setera
  • Start date Start date
C

Craig Setera

What is the easiest way to draw rectangles with rounded corners in NetCF
1.0? It seems like the region support is minimal and doing rounded
rectangles appears to be difficult.

Thanks,
Craig
 
Craig Setera said:
What is the easiest way to draw rectangles with rounded corners in NetCF
1.0? It seems like the region support is minimal and doing rounded
rectangles appears to be difficult.

This is what I use in full fw:

public void PaintRoundRect(Pen p, Brush fillBrush, int x, int y, int width,
int height, int radius)

{

GraphicsPath gp = new GraphicsPath();

gp.AddArc(x + width - radius, y, radius, radius, 270, 90);

gp.AddArc(x + width - radius, y + height - radius, radius, radius, 0, 90);

gp.AddArc(x, y + height - radius, radius, radius, 90, 90);

gp.AddArc(x, y, radius, radius, 180, 90);

gp.CloseFigure();

if (fillBrush != null)

_graphics.FillPath(fillBrush, gp);

if (p != null)

_graphics.DrawPath(p, gp);

gp.Dispose();

}
 
Back
Top