SetBounds() protected method

protected SetBounds ( Rectangle bounds ) : void
bounds Rectangle
return void
Exemplo n.º 1
0
        protected internal void SetItemLocation(ToolStripItem item, Point location)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            if (item.Owner != this)
            {
                throw new NotSupportedException("The item is not owned by this ToolStrip");
            }

            item.SetBounds(new Rectangle(location, item.Size));
        }
        private void SetItemLocation(ToolStripItem item, Point itemLocation, Size itemSize)
        {
            // make sure that things that dont fit within the display rectangle arent laid out.
            if ((item.Placement == ToolStripItemPlacement.Main) &&
                !(item is ToolStripOverflowButton))  // overflow buttons can be placed outside the display rect.

            {
                bool      horizontal  = (ToolStrip.LayoutStyle == ToolStripLayoutStyle.HorizontalStackWithOverflow);
                Rectangle displayRect = displayRectangle;
                Rectangle itemBounds  = new Rectangle(itemLocation, itemSize);
                // in horizontal if something bleeds over the top/bottom that's ok - its left/right we care about
                // same in vertical.
                if (horizontal)
                {
                    if ((itemBounds.Right > displayRectangle.Right) ||
                        (itemBounds.Left < displayRectangle.Left))
                    {
#if DEBUG
                        if (DebugLayoutTraceSwitch.TraceVerbose)
                        {
                            Debug.WriteLine(String.Format(CultureInfo.CurrentCulture, "[SplitStack.SetItemLocation] Sending Item {0} to NoMansLand as it doesnt fit horizontally within the DRect", item));
                        }
#endif
                        itemLocation = noMansLand;
                        item.SetPlacement(ToolStripItemPlacement.None);
                    }
                }
                else
                {
                    if ((itemBounds.Bottom > displayRectangle.Bottom) ||
                        (itemBounds.Top < displayRectangle.Top))
                    {
#if DEBUG
                        if (DebugLayoutTraceSwitch.TraceVerbose)
                        {
                            Debug.WriteLine(String.Format(CultureInfo.CurrentCulture, "[SplitStack.SetItemLocation] Sending Item {0} to NoMansLand as it doesnt fit verticallu within the DRect", item));
                        }
#endif

                        itemLocation = noMansLand;
                        item.SetPlacement(ToolStripItemPlacement.None);
                    }
                }
            }
            item.SetBounds(new Rectangle(itemLocation, itemSize));
        }
Exemplo n.º 3
0
 private void SetItemLocation(ToolStripItem item, Point itemLocation, Size itemSize)
 {
     if ((item.Placement == ToolStripItemPlacement.Main) && !(item is ToolStripOverflowButton))
     {
         bool      flag      = this.ToolStrip.LayoutStyle == ToolStripLayoutStyle.HorizontalStackWithOverflow;
         Rectangle rectangle = new Rectangle(itemLocation, itemSize);
         if (flag)
         {
             if ((rectangle.Right > this.displayRectangle.Right) || (rectangle.Left < this.displayRectangle.Left))
             {
                 itemLocation = this.noMansLand;
                 item.SetPlacement(ToolStripItemPlacement.None);
             }
         }
         else if ((rectangle.Bottom > this.displayRectangle.Bottom) || (rectangle.Top < this.displayRectangle.Top))
         {
             itemLocation = this.noMansLand;
             item.SetPlacement(ToolStripItemPlacement.None);
         }
     }
     item.SetBounds(new Rectangle(itemLocation, itemSize));
 }
 protected internal void SetItemLocation(ToolStripItem item, Point location)
 {
     if (item == null)
     {
         throw new ArgumentNullException("item");
     }
     if (item.Owner != this)
     {
         throw new NotSupportedException(System.Windows.Forms.SR.GetString("ToolStripCanOnlyPositionItsOwnItems"));
     }
     item.SetBounds(new Rectangle(location, item.Size));
 }
Exemplo n.º 5
0
		protected internal void SetItemLocation (ToolStripItem item, Point location)
		{
			if (item == null)
				throw new ArgumentNullException ("item");
				
			if (item.Owner != this)
				throw new NotSupportedException ("The item is not owned by this ToolStrip");
				
			item.SetBounds (new Rectangle (location, item.Size));
		}
 private void SetItemLocation(ToolStripItem item, Point itemLocation, Size itemSize)
 {
     if ((item.Placement == ToolStripItemPlacement.Main) && !(item is ToolStripOverflowButton))
     {
         bool flag = this.ToolStrip.LayoutStyle == ToolStripLayoutStyle.HorizontalStackWithOverflow;
         Rectangle rectangle = new Rectangle(itemLocation, itemSize);
         if (flag)
         {
             if ((rectangle.Right > this.displayRectangle.Right) || (rectangle.Left < this.displayRectangle.Left))
             {
                 itemLocation = this.noMansLand;
                 item.SetPlacement(ToolStripItemPlacement.None);
             }
         }
         else if ((rectangle.Bottom > this.displayRectangle.Bottom) || (rectangle.Top < this.displayRectangle.Top))
         {
             itemLocation = this.noMansLand;
             item.SetPlacement(ToolStripItemPlacement.None);
         }
     }
     item.SetBounds(new Rectangle(itemLocation, itemSize));
 }