Files
docs-desktop/dotnet-desktop-guide/framework/winforms/controls/how-to-define-z-ordering-of-docked-toolstrip-controls.md
T
Andy De George c0ba284473 Initial winforms content migrated (#18)
* Merge winforms framework content to working branch (#14)

* Breadcrumb / TOC / Move net5 to net folder (#15)

* change path from net5 to net

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Add .net 5 winforms placeholder article (#16)

* added some metadata and adjusted net5 placeholder

* corrections

* corrections

* corrections

* Test1

* Swapping landing page vs concept

* fix links

* Fix links

* Fix desc
2020-09-01 16:26:21 -07:00

2.2 KiB

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
How to: Define Z-Ordering of Docked ToolStrip Controls 03/30/2017
csharp
vb
ToolStrip control [Windows Forms]
MenuStrip control [Windows Forms]
toolbars [Windows Forms], specifying z-order
z-order
8b595429-ba9f-46af-9c55-3d5cc53f7fff

How to: Define Z-Ordering of Docked ToolStrip Controls

To position a xref:System.Windows.Forms.ToolStrip control correctly with docking, you must position the control correctly in the form's z-order.

Example

The following code example demonstrates how to arrange a xref:System.Windows.Forms.ToolStrip control and a docked xref:System.Windows.Forms.MenuStrip control by specifying the z-order.

[!code-csharpSystem.Windows.Forms.ToolStrip.Misc#21] [!code-vbSystem.Windows.Forms.ToolStrip.Misc#21]

The z-order is determined by the order in which the xref:System.Windows.Forms.ToolStrip and xref:System.Windows.Forms.MenuStrip

controls are added to the form's xref:System.Windows.Forms.Control.Controls%2A collection.

[!code-csharpSystem.Windows.Forms.ToolStrip.Misc#23] [!code-vbSystem.Windows.Forms.ToolStrip.Misc#23]

Reverse the order of these calls to the xref:System.Windows.Forms.Control.ControlCollection.Add%2A method and view the effect on the layout.

Compiling the Code

This example requires:

  • References to the System.Design, System.Drawing, and System.Windows.Forms assemblies.

See also