ToolStripItem.Placement Property

Gets the current layout of the item.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in

public ToolStripItemPlacement Placement { get; }
/** @property */
public ToolStripItemPlacement get_Placement ()

public function get Placement () : ToolStripItemPlacement

Not applicable.

Property Value

One of the ToolStripItemPlacement values.

Inspect the Placement property in a LayoutCompleted event to determine whether an item was placed on the main ToolStrip, the overflow ToolStrip, or if it is not currently showing at all. The typical reasons why an item is not displayed are that the item did not fit on the main ToolStrip and its Overflow property was set to Never.

The following code example demonstrates how to use the Placement property for custom rendering. This code example is part of a larger example provided for the ToolStripItem class.

// This method defines the behavior for rendering the
// background of a ToolStripItem. If the item is a
// RolloverItem, it paints the item's BackgroundImage 
// centered in the client area. If the mouse is in the 
// item's client area, a border is drawn around it.
// If the item is on a drop-down or if it is on the
// overflow, a gradient is painted in the background.
protected override void OnRenderItemBackground(
    ToolStripItemRenderEventArgs e)

    RolloverItem item = e.Item as RolloverItem;

    // If the ToolSTripItem is of type RolloverItem, 
    // perform custom rendering for the background.
    if (item != null)
        if (item.Placement == ToolStripItemPlacement.Overflow ||
            using (LinearGradientBrush b = new LinearGradientBrush(
                e.Graphics.FillRectangle(b, item.ContentRectangle);

        // The RolloverItem control only supports 
        // the ImageLayout.Center setting for the
        // BackgroundImage property.
        if (item.BackgroundImageLayout == ImageLayout.Center)
            // Get references to the item's ContentRectangle
            // and BackgroundImage, for convenience.
            Rectangle cr = item.ContentRectangle;
            Image bgi = item.BackgroundImage;

            // Compute the center of the item's ContentRectangle.
            int centerX = (cr.Width - bgi.Width) / 2;
            int centerY = (cr.Height - bgi.Height) / 2;

            // If the item is selected, draw the background
            // image as usual. Otherwise, draw it as disabled.
            if (item.Selected)
                e.Graphics.DrawImage(bgi, centerX, centerY);

        // If the item is in the rollover state, 
        // draw a border around it.
        if (item.Rollover)

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0