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. C#
  4. container-like behavior

container-like behavior

Scheduled Pinned Locked Moved C#
dockerquestion
5 Posts 4 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.
  • D Offline
    D Offline
    Dobromir Dimitrov
    wrote on last edited by
    #1

    When you use a panel in the designer, you can drag&drop controls in it and they are contained by the panel and not the form containing the panel. Does anyone know the secret behind this kind of behaviour?

    E N 2 Replies Last reply
    0
    • D Dobromir Dimitrov

      When you use a panel in the designer, you can drag&drop controls in it and they are contained by the panel and not the form containing the panel. Does anyone know the secret behind this kind of behaviour?

      E Offline
      E Offline
      Eduard Keilholz
      wrote on last edited by
      #2

      Erhm, i don't know what you mean with your question.... 'The secret about this behaviour??' What exactly do you want us to explain??

      .: I love it when a plan comes together :. http://www.zonderpunt.nl

      D 1 Reply Last reply
      0
      • E Eduard Keilholz

        Erhm, i don't know what you mean with your question.... 'The secret about this behaviour??' What exactly do you want us to explain??

        .: I love it when a plan comes together :. http://www.zonderpunt.nl

        D Offline
        D Offline
        Dobromir Dimitrov
        wrote on last edited by
        #3

        I'd like to know I can create my own user control that acts like a panel control. What I mean is that when I place my user control on a form and drag say a picture box from the toolbox over it, it has to behave like a panel control would - if I set the Dock property of the PictureBox to Fill, the PictureBox should fill my control and not the form.

        M 1 Reply Last reply
        0
        • D Dobromir Dimitrov

          When you use a panel in the designer, you can drag&drop controls in it and they are contained by the panel and not the form containing the panel. Does anyone know the secret behind this kind of behaviour?

          N Offline
          N Offline
          Nader Elshehabi
          wrote on last edited by
          #4

          To make your own container control, you can inherit it from Control class -or any class inheriting from it like UserControl for example-, and handle the ControlAdded event.

          Regards:rose:

          1 Reply Last reply
          0
          • D Dobromir Dimitrov

            I'd like to know I can create my own user control that acts like a panel control. What I mean is that when I place my user control on a form and drag say a picture box from the toolbox over it, it has to behave like a panel control would - if I set the Dock property of the PictureBox to Fill, the PictureBox should fill my control and not the form.

            M Offline
            M Offline
            Martin 0
            wrote on last edited by
            #5

            Hello, Maybe if you implement System.Windows.Forms.IContainerControl. All the best, Martin

            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