Drawing Rounded Rectangles?

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
 
F

Fabio

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();

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top