button 添加双击事件,解决因快速点击导致效率过慢问题

This commit is contained in:
H 2020-08-22 19:47:24 +08:00
parent 609488137c
commit e7f62d9b9b
3 changed files with 66 additions and 4 deletions

View File

@ -34,11 +34,17 @@
this.uiListBox1 = new Sunny.UI.UIListBox();
this.uiCheckBox1 = new Sunny.UI.UICheckBox();
this.uiButton1 = new Sunny.UI.UIButton();
this.button1 = new System.Windows.Forms.Button();
this.listBox1 = new System.Windows.Forms.ListBox();
this.uiButton2 = new Sunny.UI.UIButton();
this.PagePanel.SuspendLayout();
this.SuspendLayout();
//
// PagePanel
//
this.PagePanel.Controls.Add(this.uiButton2);
this.PagePanel.Controls.Add(this.listBox1);
this.PagePanel.Controls.Add(this.button1);
this.PagePanel.Controls.Add(this.uiButton1);
this.PagePanel.Controls.Add(this.uiCheckBox1);
this.PagePanel.Controls.Add(this.uiListBox1);
@ -120,6 +126,36 @@
this.uiButton1.Text = "Add Item";
this.uiButton1.Click += new System.EventHandler(this.uiButton1_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(637, 400);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(112, 35);
this.button1.TabIndex = 24;
this.button1.Text = "Add Item";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// listBox1
//
this.listBox1.FormattingEnabled = true;
this.listBox1.ItemHeight = 21;
this.listBox1.Location = new System.Drawing.Point(629, 48);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(138, 340);
this.listBox1.TabIndex = 25;
//
// uiButton2
//
this.uiButton2.Cursor = System.Windows.Forms.Cursors.Hand;
this.uiButton2.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiButton2.Location = new System.Drawing.Point(188, 400);
this.uiButton2.Name = "uiButton2";
this.uiButton2.Size = new System.Drawing.Size(100, 35);
this.uiButton2.TabIndex = 26;
this.uiButton2.Text = "Clear Item";
this.uiButton2.Click += new System.EventHandler(this.uiButton2_Click);
//
// FListBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
@ -140,5 +176,8 @@
private UIListBox uiListBox1;
private UICheckBox uiCheckBox1;
private UIButton uiButton1;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Button button1;
private UIButton uiButton2;
}
}

View File

@ -13,10 +13,10 @@ namespace Sunny.UI.Demo
public override void Init()
{
uiListBox1.Items.Clear();
for (int i = 0; i < 50; i++)
{
uiListBox1.Items.Add(i);
}
//for (int i = 0; i < 50; i++)
//{
// uiListBox1.Items.Add(i);
//}
uiImageListBox1.Items.Clear();
string[] files = System.IO.Directory.GetFiles(DirEx.CurrentDir() + "Team",
@ -44,10 +44,27 @@ namespace Sunny.UI.Demo
}
private int num = 0;
private int num2 = 0;
private void uiButton1_Click(object sender, System.EventArgs e)
{
listBox1.Items.Add(DateTime.Now.ToString("yyyyMMdd") + "_" + num2);
num2++;
uiListBox1.Items.Add(DateTime.Now.ToString("yyyyMMdd") + "_" + num);
num++;
}
private void button1_Click(object sender, EventArgs e)
{
listBox1.Items.Add(DateTime.Now.ToString("yyyyMMdd") + "_" + num2);
num2++;
uiListBox1.Items.Add(DateTime.Now.ToString("yyyyMMdd") + "_" + num);
num++;
}
private void uiButton2_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
uiListBox1.Items.Clear();
}
}
}

View File

@ -76,6 +76,12 @@ namespace Sunny.UI
base.OnClick(e);
}
protected override void OnDoubleClick(EventArgs e)
{
Focus();
base.OnClick(e);
}
private bool showTips = false;
[Description("是否显示角标"), Category("SunnyUI")]