Exemplo n.º 1
0
 public ToolStripPanelCell(System.Windows.Forms.ToolStripPanelRow parent, System.Windows.Forms.Control control)
 {
     this.maxSize           = LayoutUtils.MaxSize;
     this.cachedBounds      = Rectangle.Empty;
     this.ToolStripPanelRow = parent;
     this._wrappedToolStrip = control as ToolStrip;
     if (control == null)
     {
         throw new ArgumentNullException("control");
     }
     if (this._wrappedToolStrip == null)
     {
         throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, System.Windows.Forms.SR.GetString("TypedControlCollectionShouldBeOfType", new object[] { typeof(ToolStrip).Name }), new object[0]), control.GetType().Name);
     }
     CommonProperties.SetAutoSize(this, true);
     this._wrappedToolStrip.LocationChanging += new ToolStripLocationCancelEventHandler(this.OnToolStripLocationChanging);
     this._wrappedToolStrip.VisibleChanged   += new EventHandler(this.OnToolStripVisibleChanged);
 }
Exemplo n.º 2
0
        public ToolStripPanelCell(ToolStripPanelRow parent, Control control)
        {
#if DEBUG
            // Ensure 1:1 Cell/ToolStripPanel mapping
            _cellID = string.Format(CultureInfo.CurrentCulture, "{0}.{1}", control.Name, ++t_cellCount);
            Debug.Assert(t_cellCount <= ToolStripManager.ToolStrips.Count, "who is allocating an extra toolstrippanel cell?");
#endif

            ToolStripPanelRow = parent;
            _wrappedToolStrip = control as ToolStrip;
            ArgumentNullException.ThrowIfNull(control);
            if (_wrappedToolStrip is null)
            {
                throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, string.Format(SR.TypedControlCollectionShouldBeOfType, typeof(ToolStrip).Name)), control.GetType().Name);
            }

            CommonProperties.SetAutoSize(this, true);
            _wrappedToolStrip.LocationChanging += new ToolStripLocationCancelEventHandler(OnToolStripLocationChanging);
            _wrappedToolStrip.VisibleChanged   += new EventHandler(OnToolStripVisibleChanged);
        }
Exemplo n.º 3
0
        internal ToolStripPanelRow(ToolStripPanel parent, bool visible)
        {
#if DEBUG
            _thisRowID = ++s_rowCreationCount;
#endif
            if (DpiHelper.IsScalingRequirementMet)
            {
                _minAllowedWidth = DpiHelper.LogicalToDeviceUnitsX(MinAllowedWidth);
            }

            this.ToolStripPanel    = parent;
            _state[s_stateVisible] = visible;
            _state[s_stateDisposing | s_stateLocked | s_stateInitialized] = false;

            Debug.WriteLineIf(s_toolStripPanelRowCreationDebug.TraceVerbose, "Created new ToolStripPanelRow");

            using (LayoutTransaction lt = new LayoutTransaction(parent, this, null))
            {
                Margin = DefaultMargin;
                CommonProperties.SetAutoSize(this, true);
            }
        }