I use a technique to draw controls into a Canvas or Listbox cells to fake using Native controls.
Although this technique works very good running macOS, it doesn’t when doing the same in Windows.
It seems the .DrawInto does not draw the actually state of controls in Windows.
See screenshot. Left is the drawn version, right the control.
The code I use in the canvas is:
dim controlPicture as picture
controlPicture = window.BitmapForCaching(PushButton1.Width,PushButton1.Height)
Any thoughts why this works fine in macOS and not in Windows?
I mean another programming language, i.e. not xojo (I cant say which one), so it looks like a problem with xojo. If you raise a ticket about it the nice folks at Xojo might be able to shed some light on the issue or even fix the problem if there’s one to fix
[quote=330322:@]Its not .Net, its a competitor so I don’t want to name it, it is a Win32 exe.
Dunno what they are doing
All I can say is what we do and after a chat I understand why this doesn’t do whats expected
I have no idea about “fixing” it
This is using SendMessage with WM_PRINT and a few other params.
With the same call I can copy it to the window if I want instead of the canvas, device context is irrelevant.
The same routine doesnt work on Xojo though, the state isnt copied.
I assume that Xojo uses the same method, which is why its not working with DrawInto or my method, why I dont know.[/quote]
Not necessarily. You simply have to color the button yourself. Not quite as easy, but it should not be out of your reach. The fact that Windows controls are all rectangular makes it really simple BTW, contrary to macOS.
[quote=330486:@Christoph De Vocht]True, but in that case I could use image files instead.
But the idea is to have a ‘native’ look for each Windows iterations. So a correct working .drawinto is very handy. :)[/quote]
Never said in an ideal world a drawinto that would work identically to Mac would be a bad idea. It simply seems not to be here.
You can also “animate” your window the very same way you wanted to do it with declares. The point is you are not limited to the technique used on Mac.
Nice find on the feedback Robin, thats the same code I linked above, I should have continued converting the code from c# instead of relying on drawinto for the last stage. It looks like that works perfectly in windows. I’ve submitted a bug with the reported size of the combobox which is causing their bottom pixels to be cut off, a little extra code to use +1 on the height will get around that. Hows that Christoph?
I only see the Controls being drawn in the column “workaround” if i set .SupportsHiDPI=false.
With .SupportsHiDPI=true I don’t see anything (well, the first Workaround-Canvas one has a bit of some “blurry thing” in it) on my Windows 10 machine (using a Monitor with ScaleFactor 2x, 200%)