private void dropContainer_Closed(object sender, FormClosedEventArgs e) { if (!this.dropContainer.IsDisposed) { this.dropContainer.DropStateChange -= this.dropContainer_DropStateChange; this.dropContainer.FormClosed -= this.dropContainer_Closed; this.ParentForm.Move -= this.ParentForm_Move; this.dropContainer.Dispose(); } this.dropContainer = null; this.closedWhileInControl = (this.RectangleToScreen(this.ClientRectangle).Contains(Cursor.Position)); this.dropState = DropState.Closed; this.Invalidate(); }
protected void OpenDropDown() { if (this.dropDownItem == null) { throw new NotImplementedException("The drop down item has not been initialized! Use the InitializeDropDown() method to do so."); } if (!this.CanDrop) { return; } this.dropContainer = new DropDownContainer(this.dropDownItem); this.dropContainer.Bounds = this.GetDropDownBounds(); this.dropContainer.DropStateChange += new DropDownContainer.DropWindowArgs(this.dropContainer_DropStateChange); this.dropContainer.FormClosed += new FormClosedEventHandler(this.dropContainer_Closed); this.ParentForm.Move += new EventHandler(this.ParentForm_Move); this.dropState = DropState.Dropping; this.dropContainer.Show(this); this.dropState = DropState.Dropped; this.Invalidate(); }