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. Make a form always reside within and on top of a parent panel.

Make a form always reside within and on top of a parent panel.

Scheduled Pinned Locked Moved C#
question
3 Posts 3 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.
  • Y Offline
    Y Offline
    Ylno
    wrote on last edited by
    #1

    Hello, I'm making a GUI for an image capture program. When the user captures an image a new form is created which displays the image. Once the user has captured several images they can then look through the image-forms and decide which to save. I have a main form which contains the main controls and a large panel which takes up about half it's area. I would like: 1 the image-forms to appear within this panel and to be confined to its boundaries. 2 the image-forms to always be on top of the panel and hence always be visible. 3 the image-forms should not take control(focus) away from the main application window. Is it possible to do this ? Thanks

    M P 2 Replies Last reply
    0
    • Y Ylno

      Hello, I'm making a GUI for an image capture program. When the user captures an image a new form is created which displays the image. Once the user has captured several images they can then look through the image-forms and decide which to save. I have a main form which contains the main controls and a large panel which takes up about half it's area. I would like: 1 the image-forms to appear within this panel and to be confined to its boundaries. 2 the image-forms to always be on top of the panel and hence always be visible. 3 the image-forms should not take control(focus) away from the main application window. Is it possible to do this ? Thanks

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

      Hello, Apart from that I don't see why you want to use Forms to show images (waste of performance):

      Ylno wrote:

      1 the image-forms to appear within this panel and to be confined to its boundaries

      If you want to add a Form in the Controls Container of a Panel, you have to set the TopLevel[^] property of the Form to "false".

      Ylno wrote:

      2 the image-forms to always be on top of the panel and hence always be

      If you add it inside the panels container, it is automaticaly in front of the panel.

      Ylno wrote:

      3 the image-forms should not take control(focus) away from the main application window

      Maybe Enabled[^] does what you want. But again, you should think of other solutions, like painting the images directely on the MainForm or the panel. Therefor you need: OnPaint DrawImage[^]

      All the best, Martin

      1 Reply Last reply
      0
      • Y Ylno

        Hello, I'm making a GUI for an image capture program. When the user captures an image a new form is created which displays the image. Once the user has captured several images they can then look through the image-forms and decide which to save. I have a main form which contains the main controls and a large panel which takes up about half it's area. I would like: 1 the image-forms to appear within this panel and to be confined to its boundaries. 2 the image-forms to always be on top of the panel and hence always be visible. 3 the image-forms should not take control(focus) away from the main application window. Is it possible to do this ? Thanks

        P Offline
        P Offline
        Patrick Etc
        wrote on last edited by
        #3

        The scenario you're describing is MDI. In fact, it's EXACTLY what MDI was invented for. If you have a sub form, for example, that contains a PictureBox set to Dock = Fill, you can then set the MdiParent of each form to your main form before showing it. Make sure to set the IsMdiContainer to true for the main form. The MDI area of the main form will occupy whatever leftover space is left in the main form. That is, if you have controls that you dock right, top, left, etc., the MDI area will only take up the space that is left. This means you don't need to worry about where the MDI forms will show up.


        It has become appallingly obvious that our technology has exceeded our humanity. - Albert Einstein

        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