This project is read-only.

WinForms

Nov 19, 2008 at 5:43 PM
Hi respectable Status Unknown!
I saw xna's winforms examples, but since xen has it's own Application class, for me it looks like impossible to integrate Xen %-O
I am not skilled in WinForms, so is there any Winforms and Xen examples?
If nope, are you planning to write some sample? :S Thank you!
Nov 21, 2008 at 12:57 AM
I'll look into it. It's not something I've tried though.
Nov 26, 2008 at 11:16 AM
Edited Nov 26, 2008 at 11:17 AM

Hi.

Well, it turns out WinForms support is much more complex than it may seem on the surface. You basically have to throw away the XNA Game class and wrap everything it does yourself.

Anyway.

I've uploaded Xen 1.4, I was planning to get it out much sooner - but I've been very busy.

It has what I'm calling 'experimental' winforms support.

How to use it:
When you compile 1.4, there will be a class called 'WinFormsHostControl'. This is a Windows Forms Control. You can add this to your WinForms form in the designer.

To get xen to actually use it, then once you create your application instance, then call Run(WinFormsHostControl), instead of just 'Run()'.

Note there are some significant differences though. Run() does not start the application message loop, it has to be a 'normal' running WinForms app using the Winforms message pump (ie, just a normal winforms app).

Further, there are a number of features and methods that no longer work. For example, you cannot override SetupGraphicsDeviceManager, calling ShutDown is no longer instant, etc. Small things, but overall you should be OK.

Let me know if something goes wrong.

Nov 26, 2008 at 11:19 AM
Awesome! Thank you very much!