button 添加'是否启用双击事件'属性,解决连续点击效率问题

This commit is contained in:
H 2020-08-23 16:50:14 +08:00
parent 3848fd55c5
commit 352e68fabd
3 changed files with 29 additions and 0 deletions

View File

@ -119,6 +119,7 @@
this.uiButton1.TabIndex = 23;
this.uiButton1.Text = "Add Item";
this.uiButton1.Click += new System.EventHandler(this.uiButton1_Click);
this.uiButton1.DoubleClick += new System.EventHandler(this.uiButton1_DoubleClick);
//
// FListBox
//

View File

@ -49,5 +49,11 @@ namespace Sunny.UI.Demo
uiListBox1.Items.Add(DateTime.Now.ToString("yyyyMMdd") + "_" + num);
num++;
}
private void uiButton1_DoubleClick(object sender, EventArgs e)
{
uiListBox1.Items.Add(DateTime.Now.ToString("yyyyMMdd") + "_double_" + num);
num++;
}
}
}

View File

@ -55,6 +55,7 @@ namespace Sunny.UI
fillHoverColor = UIStyles.Blue.ButtonFillHoverColor;
fillPressColor = UIStyles.Blue.ButtonFillPressColor;
fillSelectedColor = UIStyles.Blue.ButtonFillSelectedColor;
SetStyle(ControlStyles.StandardDoubleClick, UseDoubleClick);
}
private bool isClick;
@ -76,6 +77,27 @@ namespace Sunny.UI
base.OnClick(e);
}
private bool useDoubleClick = false;
[Description("是否启用双击事件"), Category("SunnyUI")]
[DefaultValue(false)]
public bool UseDoubleClick
{
get
{
return useDoubleClick;
}
set
{
if (useDoubleClick != value)
{
useDoubleClick = value;
SetStyle(ControlStyles.StandardDoubleClick, value);
Invalidate();
}
}
}
private bool showTips = false;
[Description("是否显示角标"), Category("SunnyUI")]