Xojo is not wysiwyg

I set a window size large and tall enough to fully display this image. I add a Close button below the Canvas, then run.

The displayed image height was half of the screen (window)… the button is not even displayed !

The image size is: 1282 × 1800 @ 72 dpi
The window size is 1310 x 1890

The screen size is 3360 x 2100 @ 144 dpi…

The screen is Retina, the project does not support HDPI/Retina…
MacBook Pro M1 / Monterey 12.6.

The used code is (in Canvas Paint):

Sub Paint(g As Graphics, areas() As REALbasic.Rect) Handles Paint
  // Draw the loaded pict (if any)…
  If gPict <> Nil Then
    // Image As Picture, X As Double, Y As Double, [destWidth As Double], [destHeight As Double], [sourceX As Double], [sourceY As Double], [sourceWidth As Double], [sourceHeight As Double]
    g.DrawPicture gPict, 0,0, Me.Width/2,Me.Height/2, 0,0, gPict.Width,gPict.Height
    Me.Backdrop = gPict
  End If
End Sub

I used /2 to get the whole image; that image size is…

I resized the image from its original size (back to 72 dpi from a 300 dpi original) especially for the test…

I’m baffled !

Sounds like the Paint event was inside the Window rather than in the Canvas.

As for this line, you’re getting the expected width / height in the painted image: half the width/height size of the window.

Actually, half the width/height size of the canvas.


First, make sure the locks are set correctly for the canvas and the button.

Second, try drawing the picture, but relative to its own size:

g.DrawPicture gPict, 0,0, gpict.Width/2, gPict.Height/2, 0,0, gPict.Width,gPict.Height

Screen resolution in general has been baffling ever since the introduction of Retina and “Hi-DPI”. The documentation is not very helpful:

" * Supports Hi-DPI: Set to ON to indicate that this app should be built with support for hi resolution dots per inch displays (HiDPI)."

Yes, I could have guessed that a switch called “Hi-DPI” turns “Hi-DPI” on or off. What would be useful would be an explanation of the ramifications of turning it on or off.

1 Like