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. How do you add a control to a usercontrol during design time? [modified]

How do you add a control to a usercontrol during design time? [modified]

Scheduled Pinned Locked Moved Windows Forms
csharpvisual-studiodesigndockerquestion
3 Posts 2 Posters 0 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.
  • F Offline
    F Offline
    frappydan
    wrote on last edited by
    #1

    I designed a user control to be a container for a layout. The control itself uses three other usercontrols for tabs and title and such. My control shows up in the toolbar and I can drag it to the form in the designer and set all of it's options but this usercontrol was designed to hold one or more usercontrols of any kind. I can add any item programmatically but if I drag a control over it in the designer it will not add the control I'm dragging to my usercontrol after I drop it on it. Any ideas how this functionality can be added for the designer? I am using Visual Studio 2008 Express - C#

    modified on Thursday, September 4, 2008 11:46 PM

    F 2 Replies Last reply
    0
    • F frappydan

      I designed a user control to be a container for a layout. The control itself uses three other usercontrols for tabs and title and such. My control shows up in the toolbar and I can drag it to the form in the designer and set all of it's options but this usercontrol was designed to hold one or more usercontrols of any kind. I can add any item programmatically but if I drag a control over it in the designer it will not add the control I'm dragging to my usercontrol after I drop it on it. Any ideas how this functionality can be added for the designer? I am using Visual Studio 2008 Express - C#

      modified on Thursday, September 4, 2008 11:46 PM

      F Offline
      F Offline
      Frank Horn
      wrote on last edited by
      #2

      I had that problem myself and I'm not sure what best to do. Maybe there is a trick we both don't know. If you don't have a user control, but a control derived from Panel, you can drop controls onto it at design time and they will be added. Also I think if you have a Panel on your user control, you can drop controls onto the Panel. So maybe you can just fill your user control with a Panel and go from there.

      1 Reply Last reply
      0
      • F frappydan

        I designed a user control to be a container for a layout. The control itself uses three other usercontrols for tabs and title and such. My control shows up in the toolbar and I can drag it to the form in the designer and set all of it's options but this usercontrol was designed to hold one or more usercontrols of any kind. I can add any item programmatically but if I drag a control over it in the designer it will not add the control I'm dragging to my usercontrol after I drop it on it. Any ideas how this functionality can be added for the designer? I am using Visual Studio 2008 Express - C#

        modified on Thursday, September 4, 2008 11:46 PM

        F Offline
        F Offline
        Frank Horn
        wrote on last edited by
        #3

        Found something: read up on the ParentControlDesigner class http://msdn.microsoft.com/en-us/library/system.windows.forms.design.parentcontroldesigner(VS.71).aspx

        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