System.Windows.Forms.ToolStripItem.GetPreferredSize C# (CSharp) Method

GetPreferredSize() public method

public GetPreferredSize ( Size constrainingSize ) : Size
constrainingSize System.Drawing.Size
return System.Drawing.Size
		public virtual Size GetPreferredSize (Size constrainingSize)
		{
			return this.CalculatePreferredSize (constrainingSize);
		}

Usage Example

Example #1
0
        private void CalculatePlacementsVertical()
        {
            this.ResetItemPlacements();
            System.Windows.Forms.ToolStrip toolStrip = this.ToolStrip;
            int num = 0;

            if (this.ToolStrip.CanOverflow)
            {
                this.ForwardsWalkingIndex = 0;
                while (this.ForwardsWalkingIndex < this.ToolStrip.Items.Count)
                {
                    ToolStripItem item = toolStrip.Items[this.ForwardsWalkingIndex];
                    if (((IArrangedElement)item).ParticipatesInLayout)
                    {
                        if (item.Overflow == ToolStripItemOverflow.Always)
                        {
                            this.OverflowRequired = true;
                        }
                        if ((item.Overflow != ToolStripItemOverflow.Always) && (item.Placement == ToolStripItemPlacement.None))
                        {
                            Size size = item.AutoSize ? item.GetPreferredSize(this.displayRectangle.Size) : item.Size;
                            int  num2 = this.OverflowRequired ? this.OverflowButtonSize.Height : 0;
                            num += size.Height + item.Margin.Vertical;
                            if (num > (this.displayRectangle.Height - num2))
                            {
                                int num3 = this.SendNextItemToOverflow(num - this.displayRectangle.Height, false);
                                num -= num3;
                            }
                        }
                    }
                    this.ForwardsWalkingIndex++;
                }
            }
            this.PlaceItems();
        }
All Usage Examples Of System.Windows.Forms.ToolStripItem::GetPreferredSize