Construct Form with IntPtr Handle (MonoGame) #2693
Replies: 3 comments 1 reply
-
Hey @EclipsedButter, Thanks for the question. Usually to wrap native/platform specific windows and controls you'd reference the platform specific assembly e.g. Eto.WinForms, and use the helper methods e.g. That being said, it would be helpful to know what you want to do with the returned Window object? The only things that would be wired up currently is the window size/location, and to be able to use it as a parent for dialogs/child forms. There's no way to control the content of a wrapped native window with Eto. |
Beta Was this translation helpful? Give feedback.
-
My apologies, I should have clarified. I am migrating it to Eto so that I can run it on macOS, so I don't have access to In winforms, the |
Beta Was this translation helpful? Give feedback.
-
In Eto.Forms, there's no direct equivalent to Form.FromHandle for creating forms from an existing window handle. Here are a few options:
var winFormsHost = new WinFormsHost(); |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm in the process of migrating an application from Windows.Forms to Eto. The application was built using winforms and monogame, and initialized the main form for the application with the line
Form MainForm = (Form)Form.FromHandle(Window.Handle)
. So the handle for the new Form here is the IntPtr to an SDL window handle that is also the handle for MonoGame's Game.GameWindow instance. I don't see constructor or method in Eto for creating Forms (or any widget) with IntPtr handles. There doesn't seem to be an equivalent to the FromHandle method. How do I implement this in Eto in a way that is equivalent to how it was in winforms?Since MonoGame is already handling the creation of the window, and much of my code operates around that, I am reluctant to create the MonoGame window using an Eto Control handler (as discussed here: #692 (comment)). That said, I'm open to suggestions for that as well.
Beta Was this translation helpful? Give feedback.
All reactions