UICombobox:增加DropDown,DropDownClosed事件

This commit is contained in:
Sunny 2020-10-22 22:20:04 +08:00
parent 68a806126a
commit 451e990674
5 changed files with 19 additions and 3 deletions

Binary file not shown.

Binary file not shown.

View File

@ -100,7 +100,6 @@
this.uiColorPicker1.TabIndex = 40;
this.uiColorPicker1.Text = "uiColorPicker1";
this.uiColorPicker1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.uiColorPicker1.Value = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(159)))), ((int)(((byte)(254)))));
//
// uiLine7
//
@ -225,6 +224,7 @@
this.uiComboBox1.TabIndex = 32;
this.uiComboBox1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.uiComboBox1.Watermark = "水印文字";
this.uiComboBox1.DropDown += new System.EventHandler(this.uiComboBox1_DropDown);
//
// FCombobox
//

View File

@ -23,5 +23,14 @@ namespace Sunny.UI.Demo
{
uiTimePicker1.Value.ConsoleWriteLine();
}
private void uiComboBox1_DropDown(object sender, EventArgs e)
{
uiComboBox1.Items.Clear();
uiComboBox1.Items.Add("100");
uiComboBox1.Items.Add("101");
uiComboBox1.Items.Add("102");
uiComboBox1.Items.Add("103");
}
}
}

View File

@ -127,6 +127,7 @@ namespace Sunny.UI
{
itemForm.ValueChanged += ItemForm_ValueChanged;
itemForm.VisibleChanged += ItemForm_VisibleChanged;
itemForm.Closed += ItemForm_Closed;
}
}
@ -135,6 +136,11 @@ namespace Sunny.UI
set => itemForm = value;
}
private void ItemForm_Closed(object sender, ToolStripDropDownClosedEventArgs e)
{
DropDownClosed?.Invoke(this, null);
}
private void ItemForm_VisibleChanged(object sender, EventArgs e)
{
dropSymbol = SymbolNormal;
@ -363,13 +369,14 @@ namespace Sunny.UI
ItemForm.SetStyle(UIStyles.ActiveStyleColor);
}
DropDown?.Invoke(this, e);
ButtonClick?.Invoke(this, e);
}
}
//public event EventHandler DropDown;
public event EventHandler DropDown;
//public event EventHandler DropDownClosed;
public event EventHandler DropDownClosed;
public void Select(int start, int length)
{