I am in the middle porting one of my bigger OSX apps to Windows and stumbled across GDI+
I already figured out it enabled me to use alpha channels and antialiasing.
But can anyone explain what GDI+ exactly is/doing?
Are there any pitfalls? Does it work on all Windows versions? Does it introduce incompatibility issues?
For what it’s worth, if you do find issues, you can turn it on/off when working with it. For instance, you can surround picture creation code with App.UseGDI = true and App.UseGDI = False.
I use the ’ Advanced Graphics for Windows’ lib in almost every one of my Windows programs. It’s a complete wrapper around the full GDI+ framework and gives you much better control over graphics stuff. It’s not just about speed, but also being able to use custom paints, gradients, paths, etc…)
I was talking about my pre-Xojo experience. I found that GDI sometimes made it tricky to deal with thermal label printers which needed funky resolutions like 302dpi. For me, turning GDI on only when I needed it was a much better solution.
I will say this, if you run into something funky with graphics or printing that you can’t otherwise figure out, try turning GDI off right before the code that is giving you trouble (before creating the picture or printer object) and you may find that it helps.
lol. That’s just because you’re not equally used to program for windows. I have the same annoyance when I try to make something for mac. Those CG declares make no sense to me either. A framework you know is always more fun to work with.
To answer your question. app.UseGDI=true should be enough if you’re not planning to use only Xojo’s default Gdi+. If you plan to experiment with Advanced Graphics for Windows, put this in the app.Open event:
#if TargetWin32
if not GdiPlus.Startup then
MsgBox "GdiPlus is not supported, quitting now."
Quit
end if
#endif
and this in the app.close event:
#if TargetWin32
GdiPlus.Shutdown
#endif
and that’s it! You can now start using the advanced gdi+ functions in your app.
[quote=129274:@Alain Bailleul]@Christoph De Vocht Do you know whats good when making an Windows app? You always realise making an app for OSX is so much more fun.
lol. That’s just because you’re not equally used to program for windows. I have the same annoyance when I try to make something for mac. Those CG declares make no sense to me either. A framework you know is always more fun to work with.[/quote]
Yes, I never had a PC before (and I am using computers for over 30 years now) so making a Windows app is hard for me.
Well, I did found a good way to code for Windows (from my point that is):
I put the project on my local server. I code on my Mac and when I need to check how it looks on Windows, I compile it on Windows.
I gave Windows a fair shot for some weeks now, but really, Xojo on Windows is so slow to use I was pulling my hair of frustration more than ones.
Anyhow, Xojo is a great tool to make cross-platform apps. Most core code just works fine cross-wise but you really have to do some work to make a (modern) GUI work on other platforms.
Did you try remote debugging? I used to do stuff similar to what you are doing, but once I stumbled across Xojo’s remote debugging tool, not even close, so much easier.
Don’t forget you can override the Default projects in Xojo. I have a project in my templates directory named “Default Desktop Project” which has things like GDI+ turned on, a label subclass that has transparency turned on & a few other bits. So when I start a new project it’s already done.