Hosting a Winform view inside a user control [modified]
-
Is it possible to host a Winform view inside a user-control ? I can see it is possible in WPF using WindowsFormsHost. I have a WinForm-view where I have placed a user-control, and on that user-control I want to load a 3rd party WinForm-view dynamically. I'm thinking about issues like resize-/close-/keyboard-events etc. For more details about my problem see Embedding .NET Winforms in MFC MDI App[^]
modified on Thursday, September 23, 2010 10:03 AM
-
Is it possible to host a Winform view inside a user-control ? I can see it is possible in WPF using WindowsFormsHost. I have a WinForm-view where I have placed a user-control, and on that user-control I want to load a 3rd party WinForm-view dynamically. I'm thinking about issues like resize-/close-/keyboard-events etc. For more details about my problem see Embedding .NET Winforms in MFC MDI App[^]
modified on Thursday, September 23, 2010 10:03 AM
Rolf Kristensen wrote:
Is it possible to host a Winform view inside a user-control ?
Yes, create the form and add it to the controls-collection[^] of the UserControl[^]. You'd also want to assign the usercontrol to the
Parent
[^]-property of the form.Rolf Kristensen wrote:
I'm thinking about issues like resize-/close-/keyboard-events etc.
Keys get sent to the form if the form has focus, so in that way it'll behave like a custom control. You can also set the
Dock
property on the form, automatically resizing it to fit the parent.I are Troll :suss: