* UIComboBox: 增加StyleDropDown属性,手动修改Style时设置此属性以修改下拉框主题

* UIComboBox: 删除ScrollBarColor、ScrollBarBackColor、ScrollBarStyleInherited属性
* UIColorPicker:  增加StyleDropDown属性,手动修改Style时设置此属性以修改下拉框主题
* UIComboDataGridView: 增加StyleDropDown属性,手动修改Style时设置此属性以修改下拉框主题
* UIComboTreeView: 增加StyleDropDown属性,手动修改Style时设置此属性以修改下拉框主题
* UIDatePicker: 增加StyleDropDown属性,手动修改Style时设置此属性以修改下拉框主题
* UIDatetimePicker: 增加StyleDropDown属性,手动修改Style时设置此属性以修改下拉框主题
* UIDatePicker: 增加StyleDropDown属性,手动修改Style时设置此属性以修改下拉框主题
* UINumPadTextBox: 增加StyleDropDown属性,手动修改Style时设置此属性以修改下拉框主题
This commit is contained in:
Sunny 2024-11-10 22:43:32 +08:00
parent 76b13321e6
commit af41257d35
10 changed files with 33 additions and 53 deletions

View File

@ -20,7 +20,6 @@
******************************************************************************/
using System;
using System.Drawing;
namespace Sunny.UI
{
@ -53,24 +52,6 @@ namespace Sunny.UI
public event EventHandler BeforeListClick;
/// <summary>
/// 设置边框颜色
/// </summary>
/// <param name="color">颜色</param>
public override void SetRectColor(Color color)
{
//listBox.ItemSelectBackColor = color;
}
/// <summary>
/// 设置填充颜色
/// </summary>
/// <param name="color">颜色</param>
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);
}
}
}

View File

@ -89,6 +89,12 @@ namespace Sunny.UI
}
}
/// <summary>
/// 主题样式
/// </summary>
[DefaultValue(UIStyle.Inherited), Description("下拉框主题样式"), Category("SunnyUI")]
public UIStyle StyleDropDown { get; set; } = UIStyle.Inherited;
public override void SetDPIScale()
{
base.SetDPIScale();

View File

@ -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);
}

View File

@ -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 ScrollBarColorScrollBarBackColorScrollBarStyleInherited属性
******************************************************************************/
using System;
@ -114,38 +116,6 @@ namespace Sunny.UI
set => ListBox.ScrollBarHandleWidth = value;
}
/// <summary>
/// 填充颜色,当值为背景色或透明色或空值则不填充
/// </summary>
[Description("滚动条填充颜色"), Category("SunnyUI")]
[DefaultValue(typeof(Color), "80, 160, 255")]
public Color ScrollBarColor
{
get => ListBox.ScrollBarColor;
set => ListBox.ScrollBarColor = value;
}
/// <summary>
/// 填充颜色,当值为背景色或透明色或空值则不填充
/// </summary>
[Description("滚动条背景颜色"), Category("SunnyUI")]
[DefaultValue(typeof(Color), "243, 249, 255")]
public Color ScrollBarBackColor
{
get => ListBox.ScrollBarBackColor;
set => ListBox.ScrollBarBackColor = value;
}
/// <summary>
/// 滚动条主题样式
/// </summary>
[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()));
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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);
}

View File

@ -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)
{

View File

@ -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);
}