-1

I've got question,

I have rounded rectangle. It's only rounded on right side, and straight on left. I want to make that in other way - left rounded, right straight. What should I change?

int ArcWidth = 10 * 2;
int ArcHeight = 10 * 2;
int ArcX1 = Rect.Left;
int ArcX2 = Rect.Right -(ArcWidth + 1);
int ArcY1 = Rect.Top;
int ArcY2 = Rect.Bottom -(ArcHeight + 1);

path.AddArc(ArcX1, ArcY1, 1, 1, 180, 90); // Top Left
path.AddArc(ArcX2, ArcY1, ArcWidth, ArcHeight, 270, 90); //Top Right
path.AddArc(ArcX2, ArcY2, ArcWidth, ArcHeight, 360, 90); //Bottom Right
path.AddArc(ArcX1, ArcY2, 1, ArcHeight, 90, 90); //Bottom Left
boski
  • 1,106
  • 3
  • 21
  • 44

2 Answers2

0

Switch the sides that are rounded. Looks like you have all of your sides laid out. Switch all your numbers.

plast1K
  • 469
  • 3
  • 13
  • When I switch sides my rectangle is truncated (half size). – boski Mar 21 '13 at 15:34
  • I've tried changing ArcX1 -> X2 etc., but the only good way was to change Top Right height to 1, then it looks like http://s22.postimg.org/wwlp3hjd9/img.png?noCache=1363881618 – boski Mar 21 '13 at 16:01
0

I found solution here:

http://tech.pro/tutorial/656/csharp-creating-rounded-rectangles-using-a-graphics-path

The way is to draw a Line, not Arc... (yes I know that was obvious)

boski
  • 1,106
  • 3
  • 21
  • 44