コード例 #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);
 }
コード例 #2
0
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (disposing)
         {
             if (this._wrappedToolStrip != null)
             {
                 this._wrappedToolStrip.LocationChanging -= new ToolStripLocationCancelEventHandler(this.OnToolStripLocationChanging);
                 this._wrappedToolStrip.VisibleChanged   -= new EventHandler(this.OnToolStripVisibleChanged);
             }
             this._wrappedToolStrip = null;
             if (this.parent != null)
             {
                 ((IList)this.parent.Cells).Remove(this);
             }
             this.parent = null;
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (disposing)
         {
             if (this._wrappedToolStrip != null)
             {
                 this._wrappedToolStrip.LocationChanging -= new ToolStripLocationCancelEventHandler(this.OnToolStripLocationChanging);
                 this._wrappedToolStrip.VisibleChanged -= new EventHandler(this.OnToolStripVisibleChanged);
             }
             this._wrappedToolStrip = null;
             if (this.parent != null)
             {
                 ((IList) this.parent.Cells).Remove(this);
             }
             this.parent = null;
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }