Search code examples
c#.netwinformslayoutpanel

Putting Load Animation PictureBox Panel on Top of Tabbed Layout Pane


I have a window with a Tabbed Layout Pane containing 2 panels,The Dockmode of the tabbed layout pane is set to Fill.I need to put a Panel/Picturebox that indicates background processing at the center of the form and and on top of all the existing controls (or) on top of the first picturebox on the left pane

enter image description here

I have tried

  • Putting the PictureBox Panel on right panel,setting bring to front and moving the PictureBox panel using keyboard,but the PictureBox panel stays below.
  • Putting the picturbox containing the loading animation on top of the panel 1 picturebox is also an option,but i cannot place the loading picturbox on top of the existing picturebox.

Please help


Solution

  • To solve the positioning problem you can use either of the following options:

    1. Run-Time Solution: Create your PictureBox at run-time
    2. Design-Time Solution: Use Document Outline Window to position control

    Run-Time Solution

    You can simply create PictureBox at run-time and add it to Controls collection of the Form and when needed, simply bring it to from using BringToFront method.

    Design-Time Solution

    You can use Document Outline window to change parent of the controls and their z-index. You can simply drag and drop tree nodes (controls) to change parent and z-index of the control.

    Just for example, create a new Form, drop a Panel on form and set its Dock to Fill. Then drop a PictureBox on panel. Then using Document Outline window, in tree view, drag the PictureBox and bring it up the panel node in tree view. This way you are setting the Form as parent of the PictureBox. To move the picture box to a suitable location on form, use arrow keys or use Properties window. Don't use mouse, if you use mouse to change the location, you will change the parent unintendedly.