button imagelistbox bug优化

checkbox switch 双击效率优化
This commit is contained in:
H 2020-08-25 20:44:02 +08:00
parent d4027d9d02
commit b6aee6764f
4 changed files with 57 additions and 2 deletions

View File

@ -92,7 +92,7 @@ namespace Sunny.UI
if (useDoubleClick != value)
{
useDoubleClick = value;
SetStyle(ControlStyles.StandardDoubleClick, value);
SetStyle(ControlStyles.StandardDoubleClick, useDoubleClick);
Invalidate();
}
}

View File

@ -41,6 +41,7 @@ namespace Sunny.UI
Size = new Size(150, 29);
foreColor = UIStyles.Blue.CheckBoxForeColor;
fillColor = UIStyles.Blue.CheckBoxColor;
SetStyle(ControlStyles.StandardDoubleClick, UseDoubleClick);
}
public delegate void OnValueChanged(object sender, bool value);
@ -104,6 +105,27 @@ namespace Sunny.UI
}
}
private bool _useDoubleClick = false;
[Description("是否启用双击事件"), Category("SunnyUI")]
[DefaultValue(false)]
public bool UseDoubleClick
{
get
{
return _useDoubleClick;
}
set
{
if (_useDoubleClick != value)
{
_useDoubleClick = value;
SetStyle(ControlStyles.StandardDoubleClick, _useDoubleClick);
Invalidate();
}
}
}
protected override void OnPaintFore(Graphics g, GraphicsPath path)
{
//设置按钮标题位置

View File

@ -398,7 +398,7 @@ namespace Sunny.UI
else if (e.Delta < -10)
{
int nposnum = si.nPos + temp * SystemInformation.MouseWheelScrollLines;
ScrollBarInfo.SetScrollValue(Handle, nposnum <= si.nMax ? nposnum : si.nMax);
ScrollBarInfo.SetScrollValue(Handle, nposnum <= si.ScrollMax ? nposnum : si.ScrollMax);
}
}

View File

@ -137,12 +137,45 @@ namespace Sunny.UI
set => SetRectColor(value);
}
private bool useDoubleClick = false;
[Description("是否启用双击事件"), Category("SunnyUI")]
[DefaultValue(false)]
public bool UseDoubleClick
{
get
{
return useDoubleClick;
}
set
{
if (useDoubleClick != value)
{
useDoubleClick = value;
Invalidate();
}
}
}
protected override void OnClick(EventArgs e)
{
base.OnClick(e);
Active = !Active;
}
protected override void OnDoubleClick(EventArgs e)
{
if (!useDoubleClick)
{
base.OnClick(e);
Active = !Active;
}
else
{
base.OnDoubleClick(e);
}
}
public override void SetStyleColor(UIBaseStyle uiColor)
{
base.SetStyleColor(uiColor);