diff --git a/SunnyUI/Controls/DropItem/UIComboBoxItem.cs b/SunnyUI/Controls/DropItem/UIComboBoxItem.cs
index bd511f21..29e60d52 100644
--- a/SunnyUI/Controls/DropItem/UIComboBoxItem.cs
+++ b/SunnyUI/Controls/DropItem/UIComboBoxItem.cs
@@ -20,7 +20,6 @@
******************************************************************************/
using System;
-using System.Drawing;
namespace Sunny.UI
{
@@ -53,24 +52,6 @@ namespace Sunny.UI
public event EventHandler BeforeListClick;
- ///
- /// 设置边框颜色
- ///
- /// 颜色
- public override void SetRectColor(Color color)
- {
- //listBox.ItemSelectBackColor = color;
- }
-
- ///
- /// 设置填充颜色
- ///
- /// 颜色
- public override void SetFillColor(Color color)
- {
- //ListBox.ItemSelectForeColor = color;
- }
-
private void listBox_SelectedIndexChanged(object sender, EventArgs e)
{
DoValueChanged(this, ListBox.SelectedValue);
@@ -83,5 +64,11 @@ namespace Sunny.UI
Close();
}
}
+
+ public override void SetStyleColor(UIBaseStyle uiColor)
+ {
+ base.SetStyleColor(uiColor);
+ listBox.SetStyleColor(uiColor);
+ }
}
}
\ No newline at end of file
diff --git a/SunnyUI/Controls/DropItem/UIDropControl.cs b/SunnyUI/Controls/DropItem/UIDropControl.cs
index c58773d5..f7109924 100644
--- a/SunnyUI/Controls/DropItem/UIDropControl.cs
+++ b/SunnyUI/Controls/DropItem/UIDropControl.cs
@@ -89,6 +89,12 @@ namespace Sunny.UI
}
}
+ ///
+ /// 主题样式
+ ///
+ [DefaultValue(UIStyle.Inherited), Description("下拉框主题样式"), Category("SunnyUI")]
+ public UIStyle StyleDropDown { get; set; } = UIStyle.Inherited;
+
public override void SetDPIScale()
{
base.SetDPIScale();
diff --git a/SunnyUI/Controls/UIColorPicker.cs b/SunnyUI/Controls/UIColorPicker.cs
index 81dce89e..634790b7 100644
--- a/SunnyUI/Controls/UIColorPicker.cs
+++ b/SunnyUI/Controls/UIColorPicker.cs
@@ -20,6 +20,7 @@
* 2021-03-13: V3.0.2 增加单击事件以选中颜色
* 2022-03-10: V3.1.1 修复选中颜色不显示
* 2024-08-05: V3.6.8 增加ShowDropDown()函数
+ * 2024-11-10: V3.7.2 增加StyleDropDown属性,手动修改Style时设置此属性以修改下拉框主题
******************************************************************************
* 文件名称: UIColorPicker.cs
* 文件说明: Color picker with color wheel and eye dropper
@@ -110,6 +111,7 @@ namespace Sunny.UI
item.SelectedColor = Value;
item.Translate();
item.SetDPIScale();
+ if (StyleDropDown != UIStyle.Inherited) item.Style = StyleDropDown;
ItemForm.Show(this);
}
diff --git a/SunnyUI/Controls/UIComboBox.cs b/SunnyUI/Controls/UIComboBox.cs
index a78265c6..9f450f69 100644
--- a/SunnyUI/Controls/UIComboBox.cs
+++ b/SunnyUI/Controls/UIComboBox.cs
@@ -41,6 +41,8 @@
* 2023-12-26: V3.6.2 增加下拉界面的滚动条设置
* 2024-01-27: V3.6.3 修复在窗体构造函数设置SelectedIndex报错
* 2024-10-28: V3.7.2 增加了SelectionChangeCommitted事件,下拉框显示鼠标点击条目时响应
+ * 2024-11-10: V3.7.2 增加StyleDropDown属性,手动修改Style时设置此属性以修改下拉框主题
+ * 2024-11-10: V3.7.2 删除ScrollBarColor、ScrollBarBackColor、ScrollBarStyleInherited属性
******************************************************************************/
using System;
@@ -114,38 +116,6 @@ namespace Sunny.UI
set => ListBox.ScrollBarHandleWidth = value;
}
- ///
- /// 填充颜色,当值为背景色或透明色或空值则不填充
- ///
- [Description("滚动条填充颜色"), Category("SunnyUI")]
- [DefaultValue(typeof(Color), "80, 160, 255")]
- public Color ScrollBarColor
- {
- get => ListBox.ScrollBarColor;
- set => ListBox.ScrollBarColor = value;
- }
-
- ///
- /// 填充颜色,当值为背景色或透明色或空值则不填充
- ///
- [Description("滚动条背景颜色"), Category("SunnyUI")]
- [DefaultValue(typeof(Color), "243, 249, 255")]
- public Color ScrollBarBackColor
- {
- get => ListBox.ScrollBarBackColor;
- set => ListBox.ScrollBarBackColor = value;
- }
-
- ///
- /// 滚动条主题样式
- ///
- [DefaultValue(true), Description("滚动条主题样式"), Category("SunnyUI")]
- public bool ScrollBarStyleInherited
- {
- get => ListBox.ScrollBarStyleInherited;
- set => ListBox.ScrollBarStyleInherited = value;
- }
-
[DefaultValue(false)]
[Description("显示清除按钮"), Category("SunnyUI")]
public bool ShowClearButton
@@ -186,6 +156,8 @@ namespace Sunny.UI
FilterItemForm.AutoClose = false;
if (!FilterItemForm.Visible)
{
+ filterForm.Style = StyleDropDown;
+ if (StyleDropDown != UIStyle.Inherited) filterForm.Style = StyleDropDown;
FilterItemForm.Show(this, new Size(DropDownWidth < Width ? Width : DropDownWidth, CalcItemFormHeight()));
edit.Focus();
}
@@ -757,6 +729,7 @@ namespace Sunny.UI
dropWidth = Math.Max(DropDownWidth, dropWidth);
}
+ if (StyleDropDown != UIStyle.Inherited) dropForm.Style = StyleDropDown;
ItemForm.Show(this, new Size(dropWidth, CalcItemFormHeight()));
}
}
diff --git a/SunnyUI/Controls/UIComboDataGridView.cs b/SunnyUI/Controls/UIComboDataGridView.cs
index 643ea166..0a131999 100644
--- a/SunnyUI/Controls/UIComboDataGridView.cs
+++ b/SunnyUI/Controls/UIComboDataGridView.cs
@@ -30,6 +30,7 @@
* 2023-07-25: V3.4.1 过滤输入后,按键盘下键切换至DataGridView,选中数据后按回车可快捷选中数据
* 2023-09-25: V3.5.0 增加ClearFilter,可以清除弹窗的搜索栏文字
* 2024-03-22: V3.6.5 增加ShowDropDown()
+ * 2024-11-10: V3.7.2 增加StyleDropDown属性,手动修改Style时设置此属性以修改下拉框主题
******************************************************************************/
using System;
@@ -107,6 +108,7 @@ namespace Sunny.UI
item.SetDPIScale();
item.Translate();
item.Filter1by1 = Filter1by1;
+ if (StyleDropDown != UIStyle.Inherited) item.Style = StyleDropDown;
//ItemForm.Show(this);
ItemForm.Show(this, new Size(DropDownWidth < Width ? Width : DropDownWidth, DropDownHeight));
item.ComboDataGridViewFilterChanged += Item_ComboDataGridViewFilterChanged;
diff --git a/SunnyUI/Controls/UIComboTreeView.cs b/SunnyUI/Controls/UIComboTreeView.cs
index 03cd128d..e4f8348c 100644
--- a/SunnyUI/Controls/UIComboTreeView.cs
+++ b/SunnyUI/Controls/UIComboTreeView.cs
@@ -27,6 +27,7 @@
* 2023-06-12: V3.3.8 修复使用清空按钮后,再次打开下拉框,上次的选择内容还是存在
* 2024-03-22: V3.6.5 增加ShowDropDown()
* 2024-07-13: V3.6.7 修改下拉框全选按钮跟随主题,修改一处内置国际化翻译
+ * 2024-11-10: V3.7.2 增加StyleDropDown属性,手动修改Style时设置此属性以修改下拉框主题
******************************************************************************/
using System;
@@ -260,6 +261,7 @@ namespace Sunny.UI
item.Translate();
item.SetDPIScale();
//ItemForm.Show(this);
+ if (StyleDropDown != UIStyle.Inherited) item.Style = StyleDropDown;
int width = DropDownWidth < Width ? Width : DropDownWidth;
width = Math.Max(250, width);
item.ShowSelectedAllCheckBox = ShowSelectedAllCheckBox;
diff --git a/SunnyUI/Controls/UIDatePicker.cs b/SunnyUI/Controls/UIDatePicker.cs
index ee3d28ed..0dcbe6d9 100644
--- a/SunnyUI/Controls/UIDatePicker.cs
+++ b/SunnyUI/Controls/UIDatePicker.cs
@@ -26,6 +26,7 @@
* 2024-06-09: V3.6.6 下拉框可选放大倍数为2
* 2024-07-13: V3.6.7 修改选择日期在下拉框中显示方式
* 2024-08-28: V3.7.0 修复格式化字符串包含/时显示错误
+ * 2024-11-10: V3.7.2 增加StyleDropDown属性,手动修改Style时设置此属性以修改下拉框主题
******************************************************************************/
using System;
@@ -60,7 +61,7 @@ namespace Sunny.UI
[Browsable(false)]
public override string[] FormTranslatorProperties => ["DateYearFormat", "DateYearMonthFormat", "DateFormat"];
- static internal DateTime EffectiveMaxDate(DateTime maxDate)
+ internal static DateTime EffectiveMaxDate(DateTime maxDate)
{
DateTime maxSupportedDate = DateTimePicker.MaximumDateTime;
if (maxDate > maxSupportedDate)
@@ -70,7 +71,7 @@ namespace Sunny.UI
return maxDate;
}
- static internal DateTime EffectiveMinDate(DateTime minDate)
+ internal static DateTime EffectiveMinDate(DateTime minDate)
{
DateTime minSupportedDate = DateTimePicker.MinimumDateTime;
if (minDate < minSupportedDate)
@@ -370,6 +371,7 @@ namespace Sunny.UI
item.SetStyleColor(UIStyles.ActiveStyleColor);
item.max = MaxDate;
item.min = MinDate;
+ if (StyleDropDown != UIStyle.Inherited) item.Style = StyleDropDown;
Size size = SizeMultiple == 1 ? new Size(284, 200) : new Size(568, 400);
ItemForm.Show(this, size);
diff --git a/SunnyUI/Controls/UIDateTimePicker.cs b/SunnyUI/Controls/UIDateTimePicker.cs
index aed5537f..9e9f025b 100644
--- a/SunnyUI/Controls/UIDateTimePicker.cs
+++ b/SunnyUI/Controls/UIDateTimePicker.cs
@@ -24,6 +24,7 @@
* 2024-06-09: V3.6.6 下拉框可选放大倍数为2
* 2024-07-13: V3.6.7 修改选择日期在下拉框中显示方式
* 2024-08-28: V3.7.0 修复格式化字符串包含/时显示错误
+ * 2024-11-10: V3.7.2 增加StyleDropDown属性,手动修改Style时设置此属性以修改下拉框主题
******************************************************************************/
using System;
@@ -201,6 +202,7 @@ namespace Sunny.UI
item.Translate();
item.SetDPIScale();
item.SetStyleColor(UIStyles.ActiveStyleColor);
+ if (StyleDropDown != UIStyle.Inherited) item.Style = StyleDropDown;
Size size = SizeMultiple == 1 ? new Size(452, 200) : new Size(904, 400);
ItemForm.Show(this, size);
}
diff --git a/SunnyUI/Controls/UINumPadTextBox.cs b/SunnyUI/Controls/UINumPadTextBox.cs
index 4238b408..a748dce8 100644
--- a/SunnyUI/Controls/UINumPadTextBox.cs
+++ b/SunnyUI/Controls/UINumPadTextBox.cs
@@ -21,6 +21,7 @@
* 2023-03-26: V3.3.4 增加了最大值、最小值等属性
* 2023-06-11: V3.6.6 下拉框可选放大倍数为2
* 2024-09-03: V3.7.0 增加ShowDropDown()弹窗方法
+ * 2024-11-10: V3.7.2 增加StyleDropDown属性,手动修改Style时设置此属性以修改下拉框主题
******************************************************************************/
using System;
@@ -239,6 +240,7 @@ namespace Sunny.UI
item.NumPadType = NumPadType;
item.SetDPIScale();
item.SetStyleColor(UIStyles.ActiveStyleColor);
+ if (StyleDropDown != UIStyle.Inherited) item.Style = StyleDropDown;
if (numPadType == NumPadType.IDNumber)
{
diff --git a/SunnyUI/Controls/UITimePicker.cs b/SunnyUI/Controls/UITimePicker.cs
index 906a08c7..c2723173 100644
--- a/SunnyUI/Controls/UITimePicker.cs
+++ b/SunnyUI/Controls/UITimePicker.cs
@@ -20,6 +20,7 @@
* 2020-08-07: V2.2.7 可编辑输入
* 2020-09-16: V2.2.7 更改滚轮选择时间的方向
* 2024-06-09: V3.6.6 下拉框可选放大倍数为2
+ * 2024-11-10: V3.7.2 增加StyleDropDown属性,手动修改Style时设置此属性以修改下拉框主题
******************************************************************************/
using System;
@@ -196,6 +197,7 @@ namespace Sunny.UI
item.Translate();
item.SetDPIScale();
item.SetStyleColor(UIStyles.ActiveStyleColor);
+ if (StyleDropDown != UIStyle.Inherited) item.Style = StyleDropDown;
Size size = SizeMultiple == 1 ? new Size(168, 200) : new Size(336, 400);
ItemForm.Show(this, size);
}