g.DrawPicture – Bad Result in Windows

I wrote the following code in the Paint Event of a canvas:

[code]#If TargetMacOS
Dim picFile As FolderItem = app.ExecutableFile.Parent.Parent.Child(“Resources”).Child(“kursverwaltung.png”)
#ElseIf TargetWindows
Dim picFile As FolderItem = app.ExecutableFile.Parent.Child(“Kursverwaltung Resources”).Child(“kursverwaltung.png”)

Dim pic As Picture = Picture.Open(picFile)


In MacOS the result is just like it should be, but in Windows (in VirtualBox) it looks rather odd, although it is the same image file (in different places):

Any idea, what might cause this?

Thanks and best regards!

It’s a generally accepted fact that Windows sucks at scaling.
Which version of Xojo are you using? The Direct2D engine might be better at it than GDI+

For best results, scale your image in an image tool and use / display the proper size in your app.

[quote=318582:@Jens Knipp]I wrote the following code in the Paint Event of a canvas:


Thats bad practice in general. Not only it will slow down your canvas drawing, it will result in bad quality on a non-retina Mac and most certainly for Windows. So try to avoid scaling. especially if the scaling is huge like 1072x1072 to 100x100.

If you need HiDPI support for macOS and Windows, you should use x1 and x2 for each image instead. Thats how it works.

Okay, I didn’t know that. I will try it out.
Thank you!

@Jens Knipp
If you are using a version earlier than 2016r4, I would take a look at https://forum.xojo.com/conversation/post/67806.