GoComment Layout - Explain This?

Ok… strange one. I am attempting to lay out GoComments on the bottom of the diagram view. The calculation I was using to do so was:

comment.Location = new PointF(view.Right - comment.Width, view.Bottom - comment.Height);

Which should move the comment to the bottom right of the view and anchor it there.

However, when I do so, the follow image is what is created:

If, though I change the calculation to:

comment.Location = new PointF(view.Right - (comment.Width + comment.Width / 2), view.Bottom - (comment.Height + comment.Height / 2));

I get the following to display:

I have walked through this at run-time and the actual coordinates being used are the correct ones, and it is using the proper values to move the comment up the correct Height from the bottom. Note: I also removed the scroll bars and it was still below the view margin.

Question: Why does it chop off the bottom? Why is it that I have to bump it up half again to make it work correctly?

Please note that your calculations are mixing Control (or GoView) coordinates with GoDocument/GoObject coordinates.

You’ll get a hint of that just from seeing that the Control properties are integers, whereas GoObject (and GoDocument) properties are single floats.

Another hint would be if your view was zoomed in or out, or if it had a larger diagram that was scrolled around.

If you use the GoView.DocExtent property instead of the Control.Right and Control.Width properties et al., perhaps your code will work correctly.

No that is not the issue… I found the issue. Thanks