diff --git a/WatchList.WinForms/Control/CheckComboBox/CheckBoxComboBox.Designer.cs b/WatchList.WinForms/Control/CheckComboBox/CheckBoxComboBox.Designer.cs index 2d63de8..f1dee50 100644 --- a/WatchList.WinForms/Control/CheckComboBox/CheckBoxComboBox.Designer.cs +++ b/WatchList.WinForms/Control/CheckComboBox/CheckBoxComboBox.Designer.cs @@ -1,4 +1,4 @@ -namespace TestTask.Controls.CheckComboBox +namespace TestTask.Controls.CheckComboBox { partial class CheckBoxComboBox { diff --git a/WatchList.WinForms/Control/CheckComboBox/Component/CheckBoxComboBoxItem.cs b/WatchList.WinForms/Control/CheckComboBox/Component/CheckBoxComboBoxItem.cs index 4a2aa2d..f252b90 100644 --- a/WatchList.WinForms/Control/CheckComboBox/Component/CheckBoxComboBoxItem.cs +++ b/WatchList.WinForms/Control/CheckComboBox/Component/CheckBoxComboBoxItem.cs @@ -9,9 +9,14 @@ namespace WatchList.WinForms.Control.CheckComboBox.Component [ToolboxItem(false)] public class CheckBoxComboBoxItem : CheckBox { + /// + /// Initializes a new instance of the class. + /// Constructor. + /// /// A reference to the CheckBoxComboBox. /// A reference to the item in the ComboBox.Items that this object is extending. - public CheckBoxComboBoxItem(CheckBoxComboBox owner, object comboBoxItem) + public CheckBoxComboBoxItem( + CheckBoxComboBox owner, object comboBoxItem) : base() { DoubleBuffered = true; diff --git a/WatchList.WinForms/Control/CheckComboBox/Popup.cs b/WatchList.WinForms/Control/CheckComboBox/Popup.cs index 60f0f16..7f3ef30 100644 --- a/WatchList.WinForms/Control/CheckComboBox/Popup.cs +++ b/WatchList.WinForms/Control/CheckComboBox/Popup.cs @@ -13,6 +13,8 @@ namespace TestTask.Controls.CheckComboBox [ToolboxItem(false)] public partial class Popup : ToolStripDropDown { + private readonly ToolStripControlHost _host; + private Control content; private bool _resizableTop; private bool _resizableRight; @@ -110,23 +112,6 @@ public bool UseFadeEffect /// true if resizable; otherwise, false. public bool Resizable { get; internal set; } - private readonly ToolStripControlHost _host; - - /// - /// Gets parameters of a new window. - /// - /// An object of type used when creating a new window. - protected override CreateParams CreateParams - { - [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] - get - { - CreateParams cp = base.CreateParams; - cp.ExStyle |= NativeMethods.WS_EX_NOACTIVATE; - return cp; - } - } - public VisualStyleRenderer SizeGripRenderer { get; set; } public bool Fade { get; set; } @@ -149,6 +134,21 @@ protected override CreateParams CreateParams public Popup ChildPopup { get; set; } + /// + /// Gets parameters of a new window. + /// + /// An object of type used when creating a new window. + protected override CreateParams CreateParams + { + [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] + get + { + CreateParams cp = base.CreateParams; + cp.ExStyle |= NativeMethods.WS_EX_NOACTIVATE; + return cp; + } + } + /// /// Shows pop-up window below the specified control. /// @@ -333,28 +333,6 @@ protected override void OnClosed(ToolStripDropDownClosedEventArgs e) base.OnClosed(e); } - private void SetOwnerItem(Control control) - { - if (control == null) - { - return; - } - - if (control is Popup) - { - Popup popupControl = control as Popup; - OwnerPopup = popupControl; - OwnerPopup.ChildPopup = this; - OwnerItem = popupControl.Items[0]; - return; - } - - if (control.Parent != null) - { - SetOwnerItem(control.Parent); - } - } - protected override void OnVisibleChanged(EventArgs e) { if (!Visible) @@ -380,6 +358,28 @@ protected override void WndProc(ref Message m) base.WndProc(ref m); } + private void SetOwnerItem(Control control) + { + if (control == null) + { + return; + } + + if (control is Popup) + { + Popup popupControl = control as Popup; + OwnerPopup = popupControl; + OwnerPopup.ChildPopup = this; + OwnerItem = popupControl.Items[0]; + return; + } + + if (control.Parent != null) + { + SetOwnerItem(control.Parent); + } + } + [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] private bool InternalProcessResizing(ref Message m, bool contentControl) { diff --git a/WatchList.WinForms/Control/CheckComboBox/PopupComboBox.cs b/WatchList.WinForms/Control/CheckComboBox/PopupComboBox.cs index 2cd9599..6783ab7 100644 --- a/WatchList.WinForms/Control/CheckComboBox/PopupComboBox.cs +++ b/WatchList.WinForms/Control/CheckComboBox/PopupComboBox.cs @@ -13,6 +13,16 @@ namespace TestTask.Controls.CheckComboBox [Description("Displays an editable text box with a drop-down list of permitted values.")] public partial class PopupComboBox : ComboBox { + /// + /// The pop-up wrapper for the dropDownControl. + /// Made PROTECTED instead of PRIVATE so descendent classes can set its Resizable property. + /// Note however the pop-up properties must be set after the dropDownControl is assigned, since this + /// popup wrapper is recreated when the dropDownControl is assigned. + /// + protected Popup _dropDown = new Popup(new CheckBoxCMBListControlContainer()); + + private Control dropDownControl; + /// /// Initializes a new instance of the class. /// @@ -23,15 +33,54 @@ public PopupComboBox() base.IntegralHeight = false; } - /// - /// The pop-up wrapper for the dropDownControl. - /// Made PROTECTED instead of PRIVATE so descendent classes can set its Resizable property. - /// Note however the pop-up properties must be set after the dropDownControl is assigned, since this - /// popup wrapper is recreated when the dropDownControl is assigned. - /// - protected Popup _dropDown = new Popup(new CheckBoxCMBListControlContainer()); + /// Gets or sets this property is not relevant for this class. + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + [EditorBrowsable(EditorBrowsableState.Never)] + public new int DropDownWidth { get; set; } - private Control dropDownControl; + /// Gets or sets this property is not relevant for this class. + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + [EditorBrowsable(EditorBrowsableState.Never)] + public new int DropDownHeight + { + get => base.DropDownHeight; + set + { + _dropDown.Height = value; + base.DropDownHeight = value; + } + } + + /// Gets or sets a value indicating whether this property is not relevant for this class. + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + [EditorBrowsable(EditorBrowsableState.Never)] + public new bool IntegralHeight + { + get => base.IntegralHeight; + set => base.IntegralHeight = value; + } + + /// Gets this property is not relevant for this class. + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + [EditorBrowsable(EditorBrowsableState.Never)] + public new ObjectCollection Items + { + get => base.Items; + } + + /// Gets or sets this property is not relevant for this class. + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + [EditorBrowsable(EditorBrowsableState.Never)] + public new int ItemHeight + { + get => base.ItemHeight; + set => base.ItemHeight = value; + } /// /// Gets or sets the drop down control. @@ -98,54 +147,5 @@ protected override void WndProc(ref Message m) base.WndProc(ref m); } - - /// Gets or sets this property is not relevant for this class. - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - [EditorBrowsable(EditorBrowsableState.Never)] - public new int DropDownWidth { get; set; } - - /// Gets or sets this property is not relevant for this class. - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - [EditorBrowsable(EditorBrowsableState.Never)] - public new int DropDownHeight - { - get => base.DropDownHeight; - set - { - _dropDown.Height = value; - base.DropDownHeight = value; - } - } - - /// Gets or sets a value indicating whether this property is not relevant for this class. - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - [EditorBrowsable(EditorBrowsableState.Never)] - public new bool IntegralHeight - { - get => base.IntegralHeight; - set => base.IntegralHeight = value; - } - - /// Gets this property is not relevant for this class. - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - [EditorBrowsable(EditorBrowsableState.Never)] - public new ObjectCollection Items - { - get => base.Items; - } - - /// Gets or sets this property is not relevant for this class. - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - [EditorBrowsable(EditorBrowsableState.Never)] - public new int ItemHeight - { - get => base.ItemHeight; - set => base.ItemHeight = value; - } } }