public void DropDownControl(Control control) { _Canceled = false; _DropDownHolder = new DropDownForm { Bounds = control.Bounds }; _DropDownHolder.SetControl(control); Control parentForm = GetParentForm(_Picker); if (parentForm != null && (parentForm is Form)) { _DropDownHolder.Owner = (Form)parentForm; } PositionDropDownHolder(); _DropDownHolder.Show(); DoModalLoop(); _Canceled = _DropDownHolder.Canceled; _DropDownHolder.Dispose(); _DropDownHolder = null; }
public void DropDownControl(Control control) { if (_dropDownHolder == null) { _dropDownHolder = new DropDownForm(); } _canceled = false; // Initialize the hosting form for the control. _dropDownHolder.Bounds = control.Bounds; _dropDownHolder.SetControl(control); // Lookup a parent form for the Picker control and make the dropdown form to be owned // by it. This prevents to show the dropdown form icon when the user presses the At+Tab system // key while the dropdown form is displayed. Control pickerForm = GetParentForm(_picker); if ((pickerForm != null) && (pickerForm is Form)) { _dropDownHolder.Owner = (Form)pickerForm; } // Ensure the whole drop-down UI is displayed on the screen and show it. PositionDropDownHolder(); // Show the window but don't activate it _dropDownHolder.Show(); // ShowDialog would disable clicking outside the dropdown area! // Wait for the user to select a new color (in which case the ColorUI calls our CloseDropDown // method) or cancel the selection (no CloseDropDown called, the Cancel flag is set to True). DoModalLoop(); // Remember the cancel flag _canceled = _dropDownHolder.Canceled; // _dropDownHolder.Dispose(); // _dropDownHolder = null; }
public void DropDownControl(Control control) { _Canceled = false; _DropDownHolder = new DropDownForm {Bounds = control.Bounds}; _DropDownHolder.SetControl(control); Control parentForm = GetParentForm(_Picker); if (parentForm != null && (parentForm is Form)) { _DropDownHolder.Owner = (Form) parentForm; } PositionDropDownHolder(); _DropDownHolder.Show(); DoModalLoop(); _Canceled = _DropDownHolder.Canceled; _DropDownHolder.Dispose(); _DropDownHolder = null; }