Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows Forms
  4. Hosting a Winform view inside a user control [modified]

Hosting a Winform view inside a user control [modified]

Scheduled Pinned Locked Moved Windows Forms
csharpc++wpfwinformscom
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rolf Kristensen
    wrote on last edited by
    #1

    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

    L 1 Reply Last reply
    0
    • R Rolf Kristensen

      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

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      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:

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups