Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3791

DrawRoundRectangle does not fit in canvas

$
0
0

Drawing roundRectangles in a canvas causes some problems, as shown in the picture:
Screenshot 2024-10-09 at 18.44.08

The three rectangles above are drown in the paint event of the window:
g.DrawingColor = &cff0000
g.PenSize = 5
g.DrawRoundRectangle(10,10, 100, 100, 0, 0)
g.DrawRoundRectangle(120, 10, 100, 100, 16, 16)
g.DrawRoundRectangle(230, 10, 100, 100, 32, 32)

Already here one may notice that the last two rectangles are higher than the first one.

The three below are drown in the paint event of a canvas with Hight set to 100 (code below). And they clearly show the problem I’m facing; since the last two round rectangles get truncated at the top and at the bottom. And it does nor sound reasonable to draw round rectangles (100x100) at (100x104).
I hope I’m missing something, because if I cant find a solution I have to rely on some concocted code that tries to adjust the two mangled rectangles.
BTW: I tried also GraphicPath, but it does not solve the issue.

Suggestions welcome. Thanks.

g.DrawingColor = &cff0000
g.PenSize = 5
g.DrawRoundRectangle(10,0, 100, g.Height, 0, 0)
g.DrawRoundRectangle(120, 0, 100, g.Height, 16, 16)
g.DrawRoundRectangle(230, 0, 100, g.Height, 32, 32)

{added zipped project}
testCanvas.xojo_binary_project.zip (4.3 KB)

5 posts - 4 participants

Read full topic


Viewing all articles
Browse latest Browse all 3791

Trending Articles