I was trying to use DrawRect and DrawRoundRect in a canvas however it is not simple to achieve bordered rects and round rects with the same dimensions. It also seems that the PenHeight property only does something with round rects. But the result is only (mostly) useful, when PenHeight = Penwidth.
I made a simple demo project to show the problem.
For example in the demo do the following:
a) Set Pen width to 3 and Pen height to 10. Switch between Rect and Roundrect.
b) Set Pen width to 10 and Pen height to 1. Switch between Rect and Roundrect.
Demo project: https://cmezes.com/dl/Rects.zip
Question: Am I doing something wrong or is this a bug?
PenWidth and PenHeight USED to be two different functions… now they are not… think of them as PenSize instead
as a matter of fact… I simply ignore PenHeight… and use PenWidth only.
and I have apps that draw all kinds of shapes with adequate results
thanks for your reply.
The problem is: If do not set PenHeight when drawing rounded rects the result looks incorrect. Also I need to set PenHeight = Penwidth. I want to draw rects ans rounded rects with exactly the same width ans height.
Ok… changing them indivdually does have an effect… but not on the thickness of the line
only PENWIDTH affects the thickness … but PenHeight does seem to affect WHERE the line is actually drawn which makes it LOOK like (in some cases) the thickness is being affected, because the line is being cropped.
Use you example… set WIDTH=1, then vary HEIGHT and watch the line MOVE
I tested the project in Windows 7 and the results are much better than on Mac.
Rects and rounded rects have the same dimensions (width and height) and PenHeight is ignored.
Still a problem: The DrawRoundRect does not correctly match the FillRoundRect result: the rects seem to have different corner radiuses.