button imagelistbox bug优化
checkbox switch 双击效率优化
This commit is contained in:
parent
d4027d9d02
commit
b6aee6764f
@ -92,7 +92,7 @@ namespace Sunny.UI
|
|||||||
if (useDoubleClick != value)
|
if (useDoubleClick != value)
|
||||||
{
|
{
|
||||||
useDoubleClick = value;
|
useDoubleClick = value;
|
||||||
SetStyle(ControlStyles.StandardDoubleClick, value);
|
SetStyle(ControlStyles.StandardDoubleClick, useDoubleClick);
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ namespace Sunny.UI
|
|||||||
Size = new Size(150, 29);
|
Size = new Size(150, 29);
|
||||||
foreColor = UIStyles.Blue.CheckBoxForeColor;
|
foreColor = UIStyles.Blue.CheckBoxForeColor;
|
||||||
fillColor = UIStyles.Blue.CheckBoxColor;
|
fillColor = UIStyles.Blue.CheckBoxColor;
|
||||||
|
SetStyle(ControlStyles.StandardDoubleClick, UseDoubleClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
public delegate void OnValueChanged(object sender, bool value);
|
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)
|
protected override void OnPaintFore(Graphics g, GraphicsPath path)
|
||||||
{
|
{
|
||||||
//设置按钮标题位置
|
//设置按钮标题位置
|
||||||
|
@ -398,7 +398,7 @@ namespace Sunny.UI
|
|||||||
else if (e.Delta < -10)
|
else if (e.Delta < -10)
|
||||||
{
|
{
|
||||||
int nposnum = si.nPos + temp * SystemInformation.MouseWheelScrollLines;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,12 +137,45 @@ namespace Sunny.UI
|
|||||||
set => SetRectColor(value);
|
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)
|
protected override void OnClick(EventArgs e)
|
||||||
{
|
{
|
||||||
base.OnClick(e);
|
base.OnClick(e);
|
||||||
Active = !Active;
|
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)
|
public override void SetStyleColor(UIBaseStyle uiColor)
|
||||||
{
|
{
|
||||||
base.SetStyleColor(uiColor);
|
base.SetStyleColor(uiColor);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user