Beispiel #1
0
            internal int GetChildFragmentIndex(ToolStripItem.ToolStripItemAccessibleObject child)
            {
                if (_owningToolStrip is null || _owningToolStrip.Items is null)
                {
                    return(-1);
                }

                if (child.Owner == _owningToolStrip.Grip)
                {
                    return(0);
                }

                ToolStripItemCollection items;
                ToolStripItemPlacement  placement = child.Owner.Placement;

                if (_owningToolStrip is ToolStripOverflow)
                {
                    // Overflow items in ToolStripOverflow host are in DisplayedItems collection.
                    items = _owningToolStrip.DisplayedItems;
                }
                else
                {
                    if (_owningToolStrip.CanOverflow && _owningToolStrip.OverflowButton.Visible && child.Owner == _owningToolStrip.OverflowButton)
                    {
                        return(GetChildFragmentCount() - 1);
                    }

                    // Items can be either in DisplayedItems or in OverflowItems (if overflow)
                    items = placement == ToolStripItemPlacement.Main || child.Owner is ToolStripScrollButton
                        ? _owningToolStrip.DisplayedItems
                        : _owningToolStrip.OverflowItems;
                }

                // First we walk through the head aligned items.
                for (int index = 0; index < items.Count; index++)
                {
                    ToolStripItem item = items[index];
                    if (item.Available && item.Alignment == ToolStripItemAlignment.Left && child.Owner == items[index])
                    {
                        return(index);
                    }
                }

                // If we didn't find it, then we walk through the tail aligned items.
                for (int index = 0; index < items.Count; index++)
                {
                    ToolStripItem item = items[index];
                    if (item.Available && item.Alignment == ToolStripItemAlignment.Right && child.Owner == items[index])
                    {
                        return(index);
                    }
                }

                return(-1);
            }
		internal virtual void SetPlacement (ToolStripItemPlacement placement)
		{
			this.placement = placement;
		}
		protected ToolStripItem (string text, Image image, EventHandler onClick, string name)
		{
			this.alignment = ToolStripItemAlignment.Left;
			this.anchor = AnchorStyles.Left | AnchorStyles.Top;
			this.auto_size = true;
			this.auto_tool_tip = this.DefaultAutoToolTip;
			this.available = true;
			this.back_color = Color.Empty;
			this.background_image_layout = ImageLayout.Tile;
			this.can_select = true;
			this.display_style = this.DefaultDisplayStyle;
			this.dock = DockStyle.None;
			this.enabled = true;
			this.fore_color = Color.Empty;
			this.image = image;
			this.image_align = ContentAlignment.MiddleCenter;
			this.image_index = -1;
			this.image_key = string.Empty;
			this.image_scaling = ToolStripItemImageScaling.SizeToFit;
			this.image_transparent_color = Color.Empty;
			this.margin = this.DefaultMargin;
			this.merge_action = MergeAction.Append;
			this.merge_index = -1;
			this.name = name;
			this.overflow = ToolStripItemOverflow.AsNeeded;
			this.padding = this.DefaultPadding;
			this.placement = ToolStripItemPlacement.None;
			this.right_to_left = RightToLeft.Inherit;
			this.bounds.Size = this.DefaultSize;
			this.text = text;
			this.text_align = ContentAlignment.MiddleCenter;
			this.text_direction = DefaultTextDirection;
			this.text_image_relation = TextImageRelation.ImageBeforeText;
			this.visible = true;

			this.Click += onClick;
			OnLayout (new LayoutEventArgs (null, string.Empty));
		}
Beispiel #4
0
        protected virtual void OnSpringTableLayoutCore()
        {
            if (!this.Created)
            {
                return;
            }

            ToolStripItemOverflow[]  overflow  = new ToolStripItemOverflow[this.Items.Count];
            ToolStripItemPlacement[] placement = new ToolStripItemPlacement[this.Items.Count];
            Size proposedSize = new Size(0, Bounds.Height);

            int[] widths          = new int[this.Items.Count];
            int   total_width     = 0;
            int   toolstrip_width = DisplayRectangle.Width;
            int   i            = 0;
            int   spring_count = 0;

            foreach (ToolStripItem tsi in this.Items)
            {
                overflow[i]  = tsi.Overflow;
                widths[i]    = tsi.GetPreferredSize(proposedSize).Width + tsi.Margin.Horizontal;
                placement[i] = tsi.Overflow == ToolStripItemOverflow.Always ? ToolStripItemPlacement.None : ToolStripItemPlacement.Main;
                placement[i] = tsi.Available && tsi.InternalVisible ? placement[i] : ToolStripItemPlacement.None;
                total_width += placement[i] == ToolStripItemPlacement.Main ? widths[i] : 0;
                if (tsi is ToolStripStatusLabel && (tsi as ToolStripStatusLabel).Spring)
                {
                    spring_count++;
                }

                i++;
            }

            while (total_width > toolstrip_width)
            {
                bool removed_one = false;

                // Start at the right, removing Overflow.AsNeeded first
                for (int j = widths.Length - 1; j >= 0; j--)
                {
                    if (overflow[j] == ToolStripItemOverflow.AsNeeded && placement[j] == ToolStripItemPlacement.Main)
                    {
                        placement[j] = ToolStripItemPlacement.None;
                        total_width -= widths[j];
                        removed_one  = true;
                        break;
                    }
                }

                // If we didn't remove any AsNeeded ones, we have to start removing Never ones
                // These are not put on the Overflow, they are simply not shown
                if (!removed_one)
                {
                    for (int j = widths.Length - 1; j >= 0; j--)
                    {
                        if (overflow[j] == ToolStripItemOverflow.Never && placement[j] == ToolStripItemPlacement.Main)
                        {
                            placement[j] = ToolStripItemPlacement.None;
                            total_width -= widths[j];
                            removed_one  = true;
                            break;
                        }
                    }
                }

                // There's nothing left to remove, break or we will loop forever
                if (!removed_one)
                {
                    break;
                }
            }

            if (spring_count > 0)
            {
                int per_item = (toolstrip_width - total_width) / spring_count;
                i = 0;

                foreach (ToolStripItem tsi in this.Items)
                {
                    if (tsi is ToolStripStatusLabel && (tsi as ToolStripStatusLabel).Spring)
                    {
                        widths[i] += per_item;
                    }

                    i++;
                }
            }

            i = 0;
            Point layout_pointer = new Point(this.DisplayRectangle.Left, this.DisplayRectangle.Top);
            int   button_height  = this.DisplayRectangle.Height;

            // Now we should know where everything goes, so lay everything out
            foreach (ToolStripItem tsi in this.Items)
            {
                tsi.SetPlacement(placement[i]);

                if (placement[i] == ToolStripItemPlacement.Main)
                {
                    tsi.SetBounds(new Rectangle(layout_pointer.X + tsi.Margin.Left, layout_pointer.Y + tsi.Margin.Top, widths[i] - tsi.Margin.Horizontal, button_height - tsi.Margin.Vertical));
                    layout_pointer.X += widths[i];
                }

                i++;
            }

            this.SetDisplayedItems();
        }
        private void LayoutHorizontalToolStrip(ToolStrip ts, Rectangle bounds)
        {
            //if (!ts.Visible) return;

            ToolStripItemOverflow[]  overflow  = new ToolStripItemOverflow[ts.Items.Count];
            ToolStripItemPlacement[] placement = new ToolStripItemPlacement[ts.Items.Count];
            Size proposedSize = new Size(0, bounds.Height);

            int[] widths          = new int[ts.Items.Count];
            int   total_width     = 0;
            int   toolstrip_width = bounds.Width;
            int   i             = 0;
            bool  can_overflow  = ts.CanOverflow & !(ts is MenuStrip) & !(ts is StatusStrip);
            bool  need_overflow = false;

            foreach (ToolStripItem tsi in ts.Items)
            {
                overflow[i]  = tsi.Overflow;
                placement[i] = tsi.Overflow == ToolStripItemOverflow.Always ? ToolStripItemPlacement.Overflow : ToolStripItemPlacement.Main;
                widths[i]    = tsi.GetPreferredSize(proposedSize).Width + tsi.Margin.Horizontal;
                if (!tsi.Available)
                {
                    placement[i] = ToolStripItemPlacement.None;
                }
                total_width += placement[i] == ToolStripItemPlacement.Main ? widths[i] : 0;

                if (placement[i] == ToolStripItemPlacement.Overflow)
                {
                    need_overflow = true;
                }
                i++;
            }

            // This is needed for a button set to Overflow = Always
            if (need_overflow)
            {
                ts.OverflowButton.Visible = true;
                ts.OverflowButton.SetBounds(new Rectangle(ts.Width - 16, 0, 16, ts.Height));
                toolstrip_width -= ts.OverflowButton.Width;
            }
            else
            {
                ts.OverflowButton.Visible = false;
            }

            while (total_width > toolstrip_width)
            {
                // If we can overflow, get our overflow button setup, and subtract it's width
                // from our available width
                if (can_overflow && !ts.OverflowButton.Visible)
                {
                    ts.OverflowButton.Visible = true;
                    ts.OverflowButton.SetBounds(new Rectangle(ts.Width - 16, 0, 16, ts.Height));
                    toolstrip_width -= ts.OverflowButton.Width;
                }

                bool removed_one = false;

                // Start at the right, removing Overflow.AsNeeded first
                for (int j = widths.Length - 1; j >= 0; j--)
                {
                    if (overflow[j] == ToolStripItemOverflow.AsNeeded && placement[j] == ToolStripItemPlacement.Main)
                    {
                        placement[j] = ToolStripItemPlacement.Overflow;
                        total_width -= widths[j];
                        removed_one  = true;
                        break;
                    }
                }

                // If we didn't remove any AsNeeded ones, we have to start removing Never ones
                // These are not put on the Overflow, they are simply not shown
                if (!removed_one)
                {
                    for (int j = widths.Length - 1; j >= 0; j--)
                    {
                        if (overflow[j] == ToolStripItemOverflow.Never && placement[j] == ToolStripItemPlacement.Main)
                        {
                            placement[j] = ToolStripItemPlacement.None;
                            total_width -= widths[j];
                            removed_one  = true;
                            break;
                        }
                    }
                }

                // There's nothing left to remove, break or we will loop forever
                if (!removed_one)
                {
                    break;
                }
            }

            i = 0;
            Point start_layout_pointer = new Point(ts.DisplayRectangle.Left, ts.DisplayRectangle.Top);
            Point end_layout_pointer   = new Point(ts.DisplayRectangle.Right, ts.DisplayRectangle.Top);
            int   button_height        = ts.DisplayRectangle.Height;

            // Now we should know where everything goes, so lay everything out
            foreach (ToolStripItem tsi in ts.Items)
            {
                tsi.SetPlacement(placement[i]);

                if (placement[i] == ToolStripItemPlacement.Main)
                {
                    if (tsi.Alignment == ToolStripItemAlignment.Left)
                    {
                        tsi.SetBounds(new Rectangle(start_layout_pointer.X + tsi.Margin.Left, start_layout_pointer.Y + tsi.Margin.Top, widths[i] - tsi.Margin.Horizontal, button_height - tsi.Margin.Vertical));
                        start_layout_pointer.X += widths[i];
                    }
                    else
                    {
                        tsi.SetBounds(new Rectangle(end_layout_pointer.X - tsi.Margin.Right - tsi.Width, end_layout_pointer.Y + tsi.Margin.Top, widths[i] - tsi.Margin.Horizontal, button_height - tsi.Margin.Vertical));
                        end_layout_pointer.X -= widths[i];
                    }
                }

                i++;
            }
        }
		protected virtual void OnSpringTableLayoutCore ()
		{
			if (!this.Created)
				return;

			ToolStripItemOverflow[] overflow = new ToolStripItemOverflow[this.Items.Count];
			ToolStripItemPlacement[] placement = new ToolStripItemPlacement[this.Items.Count];
			Size proposedSize = new Size (0, Bounds.Height);
			int[] widths = new int[this.Items.Count];
			int total_width = 0;
			int toolstrip_width = DisplayRectangle.Width;
			int i = 0;
			int spring_count = 0;

			foreach (ToolStripItem tsi in this.Items) {
				overflow[i] = tsi.Overflow;
				widths[i] = tsi.GetPreferredSize (proposedSize).Width + tsi.Margin.Horizontal;
				placement[i] = tsi.Overflow == ToolStripItemOverflow.Always ? ToolStripItemPlacement.None : ToolStripItemPlacement.Main;
				placement[i] = tsi.Available && tsi.InternalVisible ? placement[i] : ToolStripItemPlacement.None;
				total_width += placement[i] == ToolStripItemPlacement.Main ? widths[i] : 0;
				if (tsi is ToolStripStatusLabel && (tsi as ToolStripStatusLabel).Spring)
					spring_count++;
					
				i++;
			}

			while (total_width > toolstrip_width) {
				bool removed_one = false;

				// Start at the right, removing Overflow.AsNeeded first
				for (int j = widths.Length - 1; j >= 0; j--)
					if (overflow[j] == ToolStripItemOverflow.AsNeeded && placement[j] == ToolStripItemPlacement.Main) {
						placement[j] = ToolStripItemPlacement.None;
						total_width -= widths[j];
						removed_one = true;
						break;
					}

				// If we didn't remove any AsNeeded ones, we have to start removing Never ones
				// These are not put on the Overflow, they are simply not shown
				if (!removed_one)
					for (int j = widths.Length - 1; j >= 0; j--)
						if (overflow[j] == ToolStripItemOverflow.Never && placement[j] == ToolStripItemPlacement.Main) {
							placement[j] = ToolStripItemPlacement.None;
							total_width -= widths[j];
							removed_one = true;
							break;
						}

				// There's nothing left to remove, break or we will loop forever	
				if (!removed_one)
					break;
			}

			if (spring_count > 0) {
				int per_item = (toolstrip_width - total_width) / spring_count;
				i = 0;
				
				foreach (ToolStripItem tsi in this.Items) {
					if (tsi is ToolStripStatusLabel && (tsi as ToolStripStatusLabel).Spring)
						widths[i] += per_item;
						
					i++;
				}
			}

			i = 0;
			Point layout_pointer = new Point (this.DisplayRectangle.Left, this.DisplayRectangle.Top);
			int button_height = this.DisplayRectangle.Height;

			// Now we should know where everything goes, so lay everything out
			foreach (ToolStripItem tsi in this.Items) {
				tsi.SetPlacement (placement[i]);

				if (placement[i] == ToolStripItemPlacement.Main) {
					tsi.SetBounds (new Rectangle (layout_pointer.X + tsi.Margin.Left, layout_pointer.Y + tsi.Margin.Top, widths[i] - tsi.Margin.Horizontal, button_height - tsi.Margin.Vertical));
					layout_pointer.X += widths[i];
				}

				i++;
			}

			this.SetDisplayedItems ();
		}
        private void LayoutVerticalToolStrip(ToolStrip ts, Rectangle bounds)
        {
            if (!ts.Visible)
            {
                return;
            }

            ToolStripItemOverflow[]  overflow  = new ToolStripItemOverflow[ts.Items.Count];
            ToolStripItemPlacement[] placement = new ToolStripItemPlacement[ts.Items.Count];
            Size proposedSize = new Size(bounds.Width, 0);

            int[] heights          = new int[ts.Items.Count];
            int[] widths           = new int[ts.Items.Count];   // needed if ts.LayoutStyle == ToolStripLayoutStyle.Table
            int   total_height     = 0;
            int   toolstrip_height = bounds.Height;
            int   i            = 0;
            bool  can_overflow = ts.CanOverflow & !(ts is MenuStrip) & !(ts is StatusStrip);

            foreach (ToolStripItem tsi in ts.Items)
            {
                overflow[i]  = tsi.Overflow;
                placement[i] = tsi.Overflow == ToolStripItemOverflow.Always ? ToolStripItemPlacement.Overflow : ToolStripItemPlacement.Main;
                var size = tsi.GetPreferredSize(proposedSize);
                heights[i] = size.Height + tsi.Margin.Vertical;
                widths[i]  = size.Width + tsi.Margin.Horizontal;
                if (!tsi.Available)
                {
                    placement[i] = ToolStripItemPlacement.None;
                }
                total_height += placement[i] == ToolStripItemPlacement.Main ? heights[i] : 0;
                i++;
            }

            ts.OverflowButton.Visible = false;

            while (total_height > toolstrip_height)
            {
                // If we can overflow, get our overflow button setup, and subtract it's width
                // from our available width
                if (can_overflow && !ts.OverflowButton.Visible)
                {
                    ts.OverflowButton.Visible = true;
                    ts.OverflowButton.SetBounds(new Rectangle(0, ts.Height - 16, ts.Width, 16));
                    toolstrip_height -= ts.OverflowButton.Height;
                }

                bool removed_one = false;

                // Start at the right, removing Overflow.AsNeeded first
                for (int j = heights.Length - 1; j >= 0; j--)
                {
                    if (overflow[j] == ToolStripItemOverflow.AsNeeded && placement[j] == ToolStripItemPlacement.Main)
                    {
                        placement[j]  = ToolStripItemPlacement.Overflow;
                        total_height -= heights[j];
                        removed_one   = true;
                        break;
                    }
                }

                // If we didn't remove any AsNeeded ones, we have to start removing Never ones
                // These are not put on the Overflow, they are simply not shown
                if (!removed_one)
                {
                    for (int j = heights.Length - 1; j >= 0; j--)
                    {
                        if (overflow[j] == ToolStripItemOverflow.Never && placement[j] == ToolStripItemPlacement.Main)
                        {
                            placement[j]  = ToolStripItemPlacement.None;
                            total_height -= heights[j];
                            removed_one   = true;
                            break;
                        }
                    }
                }

                // There's nothing left to remove, break or we will loop forever
                if (!removed_one)
                {
                    break;
                }
            }

            i = 0;
            Point start_layout_pointer = new Point(ts.DisplayRectangle.Left, ts.DisplayRectangle.Top);
            Point end_layout_pointer   = new Point(ts.DisplayRectangle.Left, ts.DisplayRectangle.Bottom);
            int   button_width         = ts.DisplayRectangle.Width;

            // Now we should know where everything goes, so lay everything out
            foreach (ToolStripItem tsi in ts.Items)
            {
                tsi.SetPlacement(placement[i]);
                // Table layout is defined to lay out items flush left.
                if (ts.LayoutStyle == ToolStripLayoutStyle.Table)
                {
                    button_width = widths[i];
                }

                if (placement[i] == ToolStripItemPlacement.Main)
                {
                    if (tsi.Alignment == ToolStripItemAlignment.Left)
                    {
                        tsi.SetBounds(new Rectangle(start_layout_pointer.X + tsi.Margin.Left, start_layout_pointer.Y + tsi.Margin.Top, button_width - tsi.Margin.Horizontal, heights[i] - tsi.Margin.Vertical));
                        start_layout_pointer.Y += heights[i];
                    }
                    else
                    {
                        tsi.SetBounds(new Rectangle(end_layout_pointer.X + tsi.Margin.Left, end_layout_pointer.Y - tsi.Margin.Bottom - tsi.Height, button_width - tsi.Margin.Horizontal, heights[i] - tsi.Margin.Vertical));
                        start_layout_pointer.Y += heights[i];
                    }
                }

                i++;
            }
        }
 internal static void SetToolStripItemPlacement(ToolStripItem item, ToolStripItemPlacement placement)
 {
     SetToolStripItemPlacementMethod.Invoke(item, new object[] { placement });
 }
		private void LayoutHorizontalToolStrip (ToolStrip ts, Rectangle bounds)
		{
			//if (!ts.Visible) return;
			
			ToolStripItemOverflow[] overflow = new ToolStripItemOverflow[ts.Items.Count];
			ToolStripItemPlacement[] placement = new ToolStripItemPlacement[ts.Items.Count];
			Size proposedSize = new Size (0, bounds.Height);
			int[] widths = new int[ts.Items.Count];
			int total_width = 0;
			int toolstrip_width = bounds.Width;
			int i = 0;
			bool can_overflow = ts.CanOverflow & !(ts is MenuStrip) & !(ts is StatusStrip);
			bool need_overflow = false;
			
			foreach (ToolStripItem tsi in ts.Items) {
				overflow[i] = tsi.Overflow;
				placement[i] = tsi.Overflow == ToolStripItemOverflow.Always ? ToolStripItemPlacement.Overflow : ToolStripItemPlacement.Main;
				widths[i] = tsi.GetPreferredSize (proposedSize).Width + tsi.Margin.Horizontal;
				if (!tsi.Available)
					placement[i] = ToolStripItemPlacement.None;
				total_width += placement[i] == ToolStripItemPlacement.Main ? widths[i] : 0;
				
				if (placement[i] == ToolStripItemPlacement.Overflow)
					need_overflow = true;
				i++;
			}

			// This is needed for a button set to Overflow = Always
			if (need_overflow) {
				ts.OverflowButton.Visible = true;
				ts.OverflowButton.SetBounds (new Rectangle (ts.Width - 16, 0, 16, ts.Height));
				toolstrip_width -= ts.OverflowButton.Width;
			} else
				ts.OverflowButton.Visible = false;
			
			while (total_width > toolstrip_width) {
				// If we can overflow, get our overflow button setup, and subtract it's width
				// from our available width				
				if (can_overflow && !ts.OverflowButton.Visible) {
					ts.OverflowButton.Visible = true;
					ts.OverflowButton.SetBounds (new Rectangle (ts.Width - 16, 0, 16, ts.Height));
					toolstrip_width -= ts.OverflowButton.Width;
				}					
				
				bool removed_one = false;
				
				// Start at the right, removing Overflow.AsNeeded first
				for (int j = widths.Length - 1; j >= 0; j--)
					if (overflow[j] == ToolStripItemOverflow.AsNeeded && placement[j] == ToolStripItemPlacement.Main) {
						placement[j] = ToolStripItemPlacement.Overflow;
						total_width -= widths[j];
						removed_one = true;
						break;
					}
			
				// If we didn't remove any AsNeeded ones, we have to start removing Never ones
				// These are not put on the Overflow, they are simply not shown
				if (!removed_one)
					for (int j = widths.Length - 1; j >= 0; j--)
						if (overflow[j] == ToolStripItemOverflow.Never && placement[j] == ToolStripItemPlacement.Main) {
							placement[j] = ToolStripItemPlacement.None;
							total_width -= widths[j];
							removed_one = true;
							break;
						}

				// There's nothing left to remove, break or we will loop forever	
				if (!removed_one)
					break;
			}

			i = 0;
			Point start_layout_pointer = new Point (ts.DisplayRectangle.Left, ts.DisplayRectangle.Top);
			Point end_layout_pointer = new Point (ts.DisplayRectangle.Right, ts.DisplayRectangle.Top);
			int button_height = ts.DisplayRectangle.Height;
			
			// Now we should know where everything goes, so lay everything out
			foreach (ToolStripItem tsi in ts.Items) {
				tsi.SetPlacement (placement[i]);
				
				if (placement[i] == ToolStripItemPlacement.Main) {
					if (tsi.Alignment == ToolStripItemAlignment.Left) {
						tsi.SetBounds (new Rectangle (start_layout_pointer.X + tsi.Margin.Left, start_layout_pointer.Y + tsi.Margin.Top, widths[i] - tsi.Margin.Horizontal, button_height - tsi.Margin.Vertical));
						start_layout_pointer.X += widths[i];
					} else {
						tsi.SetBounds (new Rectangle (end_layout_pointer.X - tsi.Margin.Right - tsi.Width, end_layout_pointer.Y + tsi.Margin.Top, widths[i] - tsi.Margin.Horizontal, button_height - tsi.Margin.Vertical));
						end_layout_pointer.X -= widths[i];
					}			
				}
			
				i++;
			}			
		}
 protected ToolStripItem()
 {
     this.bounds = Rectangle.Empty;
     this.overflow = ToolStripItemOverflow.AsNeeded;
     this.placement = ToolStripItemPlacement.None;
     this.imageAlign = ContentAlignment.MiddleCenter;
     this.textAlign = ContentAlignment.MiddleCenter;
     this.textImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     this.state = new BitVector32();
     this.imageTransparentColor = Color.Empty;
     this.imageScaling = ToolStripItemImageScaling.SizeToFit;
     this.cachedTextSize = System.Drawing.Size.Empty;
     this.displayStyle = ToolStripItemDisplayStyle.ImageAndText;
     this.state[((((((stateEnabled | stateAutoSize) | stateVisible) | stateContstructing) | stateSupportsItemClick) | stateInvalidMirroredImage) | stateMouseDownAndUpMustBeInSameItem) | stateUseAmbientMargin] = true;
     this.state[(((((((stateAllowDrop | stateMouseDownAndNoDrag) | stateSupportsRightClick) | statePressed) | stateSelected) | stateDisposed) | stateDoubleClickEnabled) | stateRightToLeftAutoMirrorImage) | stateSupportsSpaceKey] = false;
     this.SetAmbientMargin();
     this.Size = this.DefaultSize;
     this.DisplayStyle = this.DefaultDisplayStyle;
     CommonProperties.SetAutoSize(this, true);
     this.state[stateContstructing] = false;
     this.AutoToolTip = this.DefaultAutoToolTip;
 }