g.penSize vs. g.penHeight/g.penWidth

So, trying to g.drawRoundRectangle (canvas), i set the g.penSize and the arcWidth/arcHeight. I end up with a terrible roundRect who’s horizontal lines are visibly thinner than the vertical lines.

After some searching i came across someone else’s code where they set g.penHeight and g.penWidth - if i set these both the desired line thickness, i end up with nice symmetrical lines.

My concern is that autocomplete only shows graphics.penSize, and only g.penSize appears in the documented properties for graphics. There is no autocomplete for g.penWidth and g.penHeight, and these are not listed under graphics > Properties.
However searching the documentation, these are documented in isolation from graphics, and not documented as deprecated.

And at least in my case they clearly do the trick - see the screen shot below (in this example g.penSize, g.penWidth and g.penHeight are all set to 20, arcHeight/Width to 32)

My questions are:
is this expected behaviour from g.penSize?
are g.penWidth and g.penHeight actually deprecated as they appear hidden in the IDE? Is it safe to keep using these going forward?

1 Like

I would like to know the answer to this as well. I’ve reported issues with the rounded rectangles in the past but they’ve never gotten around to fixing it.

51795 - The RoundedRectangle dimensions are set incorrectly (too large) which causes the outer perimeter to be clipped.



It looks like the rectangle is being clipped at the top and the bottom by the canvas.

What OS are you running? My issues were when running under Linux.

I have also noticed this behaviour several times. Especially with the new GraphicsPath class. If you draw an object at the point (0, 0) in a Graphics, the left and upper border will be cropped, because the border is drawn centered (middle) by the Xojo framework.
The offset in GraphicsPath appears in all Add methods.

[code]g.PenSize = 2

g.DrawingColor = Color.White
g.FillRectangle(0, 0, g.Width, g.Height)

g.DrawingColor = Color.Red
g.DrawRoundRectangle(0, 0, 100, 100, 10, 10)

Var path As New GraphicsPath
path.AddRoundRectangle(105, 0, 100, 100, 10, 10)

I just ran into this too. If you search on YouTube for ‘Printing and Reporting in Xojo’ you’ll find a demo of of the example file ‘GraphicsPrintingExample’. In the youtube demo, you can see the code as g.penWidth and g.penHeight. Yet in the sample code currently downloaded with Xojo, both of those statements are replaced with g.penSize. Two statements, one after the other, that are identical. Odd.

g.pensize doesn’t seem to be a substitute for g.penWidth and g.penHeight - but the latter 2 appear deprecated?

Maybe still the same problem I reported back in 2017?
See case <https://xojo.com/issue/48989>