From 092761ac100f55c0bbc5468df3e15b86be3f3078 Mon Sep 17 00:00:00 2001 From: Stan___Kudri <53861218+Stan-Kudri@users.noreply.github.com> Date: Sat, 17 Feb 2024 14:26:06 +0300 Subject: [PATCH] WatchList - Fixed builder/linter. --- .../CheckBoxCMBListControlContainer.cs | 46 +++++++ .../CheckBoxCMBListControlContainer.resx | 120 ++++++++++++++++++ .../Control/CheckComboBox/CheckBoxComboBox.cs | 44 +------ .../Control/CheckComboBox/PopupComboBox.cs | 2 +- 4 files changed, 168 insertions(+), 44 deletions(-) create mode 100644 WatchList.WinForms/Control/CheckComboBox/CheckBoxCMBListControlContainer.cs create mode 100644 WatchList.WinForms/Control/CheckComboBox/CheckBoxCMBListControlContainer.resx diff --git a/WatchList.WinForms/Control/CheckComboBox/CheckBoxCMBListControlContainer.cs b/WatchList.WinForms/Control/CheckComboBox/CheckBoxCMBListControlContainer.cs new file mode 100644 index 00000000..1d0b9c51 --- /dev/null +++ b/WatchList.WinForms/Control/CheckComboBox/CheckBoxCMBListControlContainer.cs @@ -0,0 +1,46 @@ +using System.ComponentModel; + +namespace TestTask.Controls.CheckComboBox +{ + /// + /// A container control for the ListControl to ensure the ScrollBar on the ListControl does not + /// Paint over the Size grip. Setting the Padding or Margin on the Popup or host control does + /// not work as I expected. + /// + [ToolboxItem(false)] + public class CheckBoxCMBListControlContainer : UserControl + { + #region CONSTRUCTOR + + public CheckBoxCMBListControlContainer() + : base() + { + BackColor = SystemColors.Window; + BorderStyle = BorderStyle.FixedSingle; + AutoScaleMode = AutoScaleMode.Inherit; + ResizeRedraw = true; + + // If you don't set this, then resize operations cause an error in the base class. + MinimumSize = new Size(1, 1); + MaximumSize = new Size(500, 500); + } + #endregion + + #region RESIZE OVERRIDE REQUIRED BY THE POPUP CONTROL + + /// + /// Prescribed by the Popup class to ensure Resize operations work correctly. + /// + /// + protected override void WndProc(ref Message m) + { + if ((Parent as Popup).ProcessResizing(ref m)) + { + return; + } + + base.WndProc(ref m); + } + #endregion + } +} diff --git a/WatchList.WinForms/Control/CheckComboBox/CheckBoxCMBListControlContainer.resx b/WatchList.WinForms/Control/CheckComboBox/CheckBoxCMBListControlContainer.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/WatchList.WinForms/Control/CheckComboBox/CheckBoxCMBListControlContainer.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WatchList.WinForms/Control/CheckComboBox/CheckBoxComboBox.cs b/WatchList.WinForms/Control/CheckComboBox/CheckBoxComboBox.cs index 8ab839dd..787a32d7 100644 --- a/WatchList.WinForms/Control/CheckComboBox/CheckBoxComboBox.cs +++ b/WatchList.WinForms/Control/CheckComboBox/CheckBoxComboBox.cs @@ -25,7 +25,7 @@ public CheckBoxComboBox() // Dumps the ListControl in a(nother) Container to ensure the ScrollBar on the ListControl does not // Paint over the Size grip. Setting the Padding or Margin on the Popup or host control does // not work as I expected. I don't think it can work that way. - CheckBoxComboBoxListControlContainer ContainerControl = new CheckBoxComboBoxListControlContainer(); + CheckBoxCMBListControlContainer ContainerControl = new CheckBoxCMBListControlContainer(); CheckComboBoxListControl = new CheckBoxComboBoxListControl(this); CheckComboBoxListControl.Items.CheckBoxCheckedChanged += new EventHandler(Items_CheckBoxChanged); ContainerControl.Controls.Add(CheckComboBoxListControl); @@ -354,48 +354,6 @@ private void CheckBoxProperties_Changed(object sender, EventArgs e) #endregion } - /// - /// A container control for the ListControl to ensure the ScrollBar on the ListControl does not - /// Paint over the Size grip. Setting the Padding or Margin on the Popup or host control does - /// not work as I expected. - /// - [ToolboxItem(false)] - public class CheckBoxComboBoxListControlContainer : UserControl - { - #region CONSTRUCTOR - - public CheckBoxComboBoxListControlContainer() - : base() - { - BackColor = SystemColors.Window; - BorderStyle = BorderStyle.FixedSingle; - AutoScaleMode = AutoScaleMode.Inherit; - ResizeRedraw = true; - - // If you don't set this, then resize operations cause an error in the base class. - MinimumSize = new Size(1, 1); - MaximumSize = new Size(500, 500); - } - #endregion - - #region RESIZE OVERRIDE REQUIRED BY THE POPUP CONTROL - - /// - /// Prescribed by the Popup class to ensure Resize operations work correctly. - /// - /// - protected override void WndProc(ref Message m) - { - if ((Parent as Popup).ProcessResizing(ref m)) - { - return; - } - - base.WndProc(ref m); - } - #endregion - } - /// /// This ListControl that pops up to the User. It contains the CheckBoxComboBoxItems. /// The items are docked DockStyle.Top in this control. diff --git a/WatchList.WinForms/Control/CheckComboBox/PopupComboBox.cs b/WatchList.WinForms/Control/CheckComboBox/PopupComboBox.cs index 553cb4b6..170e1dd1 100644 --- a/WatchList.WinForms/Control/CheckComboBox/PopupComboBox.cs +++ b/WatchList.WinForms/Control/CheckComboBox/PopupComboBox.cs @@ -25,7 +25,7 @@ public PopupComboBox() /// 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 CheckBoxComboBoxListControlContainer()); + protected Popup _dropDown = new Popup(new CheckBoxCMBListControlContainer()); private Control dropDownControl;