diff --git a/SunnyUI.Demo/Controls/FListBox.Designer.cs b/SunnyUI.Demo/Controls/FListBox.Designer.cs index ee41e37e..ae31af34 100644 --- a/SunnyUI.Demo/Controls/FListBox.Designer.cs +++ b/SunnyUI.Demo/Controls/FListBox.Designer.cs @@ -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 // diff --git a/SunnyUI.Demo/Controls/FListBox.cs b/SunnyUI.Demo/Controls/FListBox.cs index 173c71ab..1165bbf7 100644 --- a/SunnyUI.Demo/Controls/FListBox.cs +++ b/SunnyUI.Demo/Controls/FListBox.cs @@ -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++; + } } } \ No newline at end of file diff --git a/SunnyUI/Controls/UIButton.cs b/SunnyUI/Controls/UIButton.cs index e29ab29f..f78e4ed0 100644 --- a/SunnyUI/Controls/UIButton.cs +++ b/SunnyUI/Controls/UIButton.cs @@ -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")]