--- title: "How to: Change the Spacing and Alignment of ToolStrip Items" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "ToolStrip control [Windows Forms], aligning items" - "examples [Windows Forms], toolbars" - "toolbars [Windows Forms], aligning items" ms.assetid: cd483466-0f49-43df-addf-e2b5fcd64027 --- # How to: Change the Spacing and Alignment of ToolStrip Items in Windows Forms The control fully supports layout features such as sizing, the spacing of controls relative to each other, the arrangement of controls on the , and the spacing of controls relative to the . Because the default value of the property is `true`, controls are sized automatically unless you set the property to `false`. ### To manually size a ToolStripItem 1. Set the property to `false` for the associated control. ```vb ToolStripButton1.AutoSize = False ``` ```csharp toolStripButton1.AutoSize = false; ``` 2. Set the property the way you want for the associated . ### To set the spacing of a ToolStripItem 1. Insert the desired values, in pixels, into the property of the associated control. The values of the property specify the spacing between the item and adjacent items in this order: Left, Top, Right, and Bottom. ```vb ToolStripTextBox1.Margin = New System.Windows.Forms.Padding _ (3, 0, 3, 0) ``` ```csharp toolStripTextBox1.Margin = new System.Windows.Forms.Padding (3, 0, 3, 0); ``` ### To align a ToolStripItem to the right side of the ToolStrip 1. Set the property to for the associated control. By default, is set to , which aligns controls to the left side of the . ```vb ToolStripSplitButton1.Alignment = _ System.Windows.Forms.ToolStripItemAlignment.Right ``` ```csharp toolStripSplitButton1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; ``` ### To arrange ToolStrip items on the ToolStrip - Set the property to the value of that you want. ```vb ToolStripDropDown1.LayoutStyle = _ System.Windows.Forms.ToolStripLayoutStyle.Flow ``` ```csharp toolStripDropDown1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow; ``` ## See also - - - - - - - - [ToolStrip Control Overview](toolstrip-control-overview-windows-forms.md) - [ToolStrip Control Architecture](toolstrip-control-architecture.md) - [ToolStrip Technology Summary](toolstrip-technology-summary.md)