This happens while I was refactoring my code and it goes well. Then I made my test using a Portrait image to be sure it works with the two orientations images: Portrait and Landscape.
The code below centers a landscape window. OK, why not. But, if I use a Portrait image, I also get the image centered.And this is normally not possible with a fixed X value and an image with a smaller width….
Same image, rotated and resized; one is 316 pixels width, the second is 920 pixels width.
Xojo 2021r1.1
Big Sur
MacBook Pro M1
Image.Graphics.DrawPicture Dart,52,Align_Y
I even use 0 instead of 52 and get the image centered.
I cleared Xojo Cache folder, quit Wojo and restart.
The only thing I do not do (yet) is to shutdown and reboot, then test again.
BTW: 52 is the correct value to center horizontally the Landscape image. I computed it manually (*). But the real code to be tested is one that compute by itself the value to center the image using the passed (I was suspicious, so I replaced Align_X with 52, then 0, and the image is still centered with the Portrait image !
Image is a fixed sized image. I computed the value to center horizontally the Dart image with a sheet of paper and pen.Old methods can be good methods.
Nota: I also have troubles with vertical alignments (Top, Center and Bottom). Center is correct, but the other two may vary.
Align_X and Align_Y are not Static nor Properties, only standard local variables; and this may be related…