5

I'm trying to use paint code to draw a roundrect with different corner radii. I have nearly everything working by drawing two circles and two roundrects. The problem is I can't make one of the roundrects draw at x offset circle radius have width of "frame.width - circle_radius" - the end effect being it keeps aligned to the right hand edge of the frame.

shapes

It feels like I should be able to write frame.width - largeCornerRadius in an expression editor but PaintCode objects to the frame reference.

That said, i's beginning to feels like I could write this code quicker by hand :-)

Rog
  • 17,070
  • 9
  • 50
  • 73
  • I totally agree. I feel like this is a major issue with paint code as I too can wrote this code faster manually... – JoeBayLD Jul 21 '17 at 07:11

3 Answers3

1

I don't have an answer to my specific stated question but I have discovered a better way to draw my roundrect as four different rects and turning off the roundrects on the "inner corners:

enter image description here

As you'd expect the drawing code is much better and it resizes well with the enclosing frame.

Rog
  • 17,070
  • 9
  • 50
  • 73
0

You can also :

  • use a set of rect, oval or other shapes
  • select them and "union" to get one bezier curve for the whole shape
  • selection each point (or a set of points) of the resulting bezier and fix springs on each of them as fixed or fluid from the edge of the surrounding frame.
chepiok
  • 193
  • 12
  • Union of shapes doesn't resize well - or didn't when I tried. Maybe I didn't have the trick of attaching frames and springs to Bezier points. – Rog Sep 22 '14 at 10:44
  • Did you tried to select one or more points on a bezier path and properly set springs ? – chepiok Sep 22 '14 at 22:26
0

I see this question is old, but let me show how to achieve this using Springs & Struts.

Resizable rounded rect with different corner radii

Let’s use 2 circles and 2 rounded rectangle, each having only one corner rounded, just like you have. Once you draw a Frame around these shapes, their Springs & Struct inspector becomes enabled.

Inspector for resizing

Here you can click each of 6 segments to toggle fixed or flexible dimension for each shape. For Red Circle, make flexible only top and right margin (just like on the image above) and for Blue Circle the opposite margins (bottom and left). Then for both rectangles make flexible size and fixed margins.

Inspector for rectangle

For more information, check out our videos, blog, and documentation on this topic.

– PaintCode Support

Tricertops
  • 8,492
  • 1
  • 39
  • 41