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