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. Adding Controls to UserControl / Component in VS Designer

Adding Controls to UserControl / Component in VS Designer

Scheduled Pinned Locked Moved Windows Forms
questionvisual-studiohelp
2 Posts 2 Posters 2 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.
  • J Offline
    J Offline
    JamesParsons
    wrote on last edited by
    #1

    Hi, I'm trying to set up a UserControl or Component that consists of a label, which is colored and has Dock set to Top so that it spans the top of the UserControl/Component. Under this is a Panel, dock set to Fill. When I use this, I want controls that I add to it to be placed in the Panel. But I'm running into difficulties: When I try to do this by creating a UserControl, I cannot add Controls to an instance of it in the VS Designer. When I try to do this with a Component(inheriting from the Panel class), I can add to it, but the Controls end up in the top level Panel, not the inner panel. I could get around this by adding to it programatically, using a custom Add method, but I'd really like to be able to use the designer! Maybe the technique I'm using is incorrect? Or maybe I need to add some kind of override for my UserControl/Component's Add method? How do I do this? Thanks for any help you can offer me.

    S 1 Reply Last reply
    0
    • J JamesParsons

      Hi, I'm trying to set up a UserControl or Component that consists of a label, which is colored and has Dock set to Top so that it spans the top of the UserControl/Component. Under this is a Panel, dock set to Fill. When I use this, I want controls that I add to it to be placed in the Panel. But I'm running into difficulties: When I try to do this by creating a UserControl, I cannot add Controls to an instance of it in the VS Designer. When I try to do this with a Component(inheriting from the Panel class), I can add to it, but the Controls end up in the top level Panel, not the inner panel. I could get around this by adding to it programatically, using a custom Add method, but I'd really like to be able to use the designer! Maybe the technique I'm using is incorrect? Or maybe I need to add some kind of override for my UserControl/Component's Add method? How do I do this? Thanks for any help you can offer me.

      S Offline
      S Offline
      Scott Dorman
      wrote on last edited by
      #2

      I don't think a user control will allow you to do this. Have you tried making the panel you want to be modifiable public?

      ----------------------------- In just two days, tomorrow will be yesterday. http://geekswithblogs.net/sdorman

      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