--- title: "How to: Define Z-Ordering of Docked ToolStrip Controls" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "ToolStrip control [Windows Forms]" - "MenuStrip control [Windows Forms]" - "toolbars [Windows Forms], specifying z-order" - "z-order" ms.assetid: 8b595429-ba9f-46af-9c55-3d5cc53f7fff --- # How to: Define Z-Ordering of Docked ToolStrip Controls To position a 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 control and a docked control by specifying the z-order. [!code-csharp[System.Windows.Forms.ToolStrip.Misc#21](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.ToolStrip.Misc/CS/Program.cs#21)] [!code-vb[System.Windows.Forms.ToolStrip.Misc#21](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.ToolStrip.Misc/VB/Program.vb#21)] The z-order is determined by the order in which the and controls are added to the form's collection. [!code-csharp[System.Windows.Forms.ToolStrip.Misc#23](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.ToolStrip.Misc/CS/Program.cs#23)] [!code-vb[System.Windows.Forms.ToolStrip.Misc#23](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.ToolStrip.Misc/VB/Program.vb#23)] Reverse the order of these calls to the 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 - - - - - - [ToolStrip Control](toolstrip-control-windows-forms.md)