using System; using System.Drawing; using System.Windows.Forms; namespace AT.STO.UI.Win { /// /// Represents the method which responds to a event. /// /// /// public delegate void DropDownCancelEventHandler(object sender, DropDownCancelEventArgs e); /// /// Represents the method which responds to a event. /// /// /// public delegate void DropDownClosedEventHandler(object sender, DropDownClosedEventArgs e); /// /// /// /// The object firing the event. /// public delegate void DropDownValueChangedEventHandler(object sender, DropDownValueChangedEventArgs e); /// /// Arguments to a . Provides a /// reference to the popup form that is to be closed and /// allows the operation to be cancelled. /// /// Thousand thanks to Steve McMahon: /// http://www.vbaccelerator.com/home/NET/Code/Controls/Popup_Windows/Popup_Windows/Popup_Form_Demonstration.asp /// public class DropDownCancelEventArgs : EventArgs { #region Private Variable Declarations private Point _cursorLocation; private readonly Form _dropDown = null; #endregion #region Constructor / Destructor /// /// Constructs a new instance of this class. /// /// The popup form /// The mouse location, if any, where the /// mouse event that would cancel the popup occured. public DropDownCancelEventArgs(Form DropDown, Point CursorLocation) { _dropDown = DropDown; _cursorLocation = CursorLocation; Cancel = false; } #endregion #region Public Properties /// /// /// public bool Cancel { get; set; } = false; /// /// /// public Point CursorLocation => _cursorLocation; /// /// /// public Form DropDown => _dropDown; #endregion } /// /// Contains event information for a event. /// /// Thousand thanks to Steve McMahon: /// http://www.vbaccelerator.com/home/NET/Code/Controls/Popup_Windows/Popup_Windows/Popup_Form_Demonstration.asp /// public class DropDownClosedEventArgs : EventArgs { #region Private Variable Declarations private readonly Form _dropDown = null; #endregion #region Constructor / Destructor /// /// Constructs a new instance of this class for the specified /// popup form. /// /// DropDown Form which is being closed. public DropDownClosedEventArgs(Form DropDown) => _dropDown = DropDown; #endregion #region Public Properties /// /// Gets the dropdown form which is being closed. /// public Form DropDown => _dropDown; #endregion } /// /// Contains event information for DropDownValueChangedEventHandler. /// public class DropDownValueChangedEventArgs : EventArgs { #region Private Variable Declarations #endregion #region Constructor / Destructor /// /// Default Constructor /// public DropDownValueChangedEventArgs() { } /// /// Initialization with the control's value. /// /// public DropDownValueChangedEventArgs(object Value) => this.Value = Value; #endregion #region Public Properties /// /// Gets or sets the control's value. /// public object Value { get; set; } = null; #endregion } }