ToolStrip::AutoSize Property
Gets or sets a value indicating whether the control is automatically resized to display its entire contents.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
public: [BrowsableAttribute(true)] property bool AutoSize { virtual bool get() override; virtual void set(bool value) override; }
Property Value
Type: System::Booleantrue if the control adjusts its width to closely fit its contents; otherwise, false. The default is true.
If you set AutoSize to false and the ToolStrip is embedded in a ToolStripContainer panel, the bounds of the ToolStrip are not translated when you move the ToolStrip to a different panel of the ToolStripContainer. To translate the bounds properly, synchronize the LayoutStyleChanged event, check the value of the Orientation property, and resize the ToolStrip.
The Image, ImageAlign, ImageIndex, ImageKey, and ImageScaling properties pertain to various aspects of image handling. Use images in ToolStrip controls by setting these properties directly or by setting the run-time–only ImageList property.
Image scaling is determined by the interaction of properties in both ToolStrip and ToolStripItem, as follows:
ImageScalingSize is the scale of the final image as determined by the combination of the image's ImageScaling setting and the container's AutoSize setting.
If AutoSize is true (the default) and ToolStripItemImageScaling is SizeToFit, no image scaling occurs, and the ToolStrip size is that of the largest item, or a prescribed minimum size.
If AutoSize is false and ToolStripItemImageScaling is None, neither image nor ToolStrip scaling occurs.
Available since 2.0