* UICombobox: 增加ShowDropDown函数
This commit is contained in:
parent
a874692b34
commit
59605afccb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
11
SunnyUI/Controls/DropItem/UIComboBoxItem.Designer.cs
generated
11
SunnyUI/Controls/DropItem/UIComboBoxItem.Designer.cs
generated
@ -35,26 +35,25 @@
|
|||||||
//
|
//
|
||||||
this.listBox.BackColor = System.Drawing.Color.Transparent;
|
this.listBox.BackColor = System.Drawing.Color.Transparent;
|
||||||
this.listBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.listBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.listBox.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
this.listBox.FillColor = System.Drawing.Color.White;
|
||||||
this.listBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(32)))), ((int)(((byte)(32)))));
|
this.listBox.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
this.listBox.ItemSelectBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
|
this.listBox.FormatString = "";
|
||||||
this.listBox.ItemSelectForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
this.listBox.ItemSelectForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
||||||
this.listBox.Location = new System.Drawing.Point(0, 0);
|
this.listBox.Location = new System.Drawing.Point(0, 0);
|
||||||
this.listBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
this.listBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||||
|
this.listBox.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.listBox.Name = "listBox";
|
this.listBox.Name = "listBox";
|
||||||
this.listBox.Padding = new System.Windows.Forms.Padding(2);
|
this.listBox.Padding = new System.Windows.Forms.Padding(2);
|
||||||
this.listBox.Radius = 0;
|
this.listBox.Radius = 0;
|
||||||
this.listBox.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
|
|
||||||
this.listBox.Size = new System.Drawing.Size(184, 210);
|
this.listBox.Size = new System.Drawing.Size(184, 210);
|
||||||
this.listBox.Style = Sunny.UI.UIStyle.Custom;
|
|
||||||
this.listBox.TabIndex = 3;
|
this.listBox.TabIndex = 3;
|
||||||
this.listBox.Text = null;
|
this.listBox.Text = null;
|
||||||
this.listBox.ItemClick += new System.EventHandler(this.ListBox_Click);
|
this.listBox.ItemClick += new System.EventHandler(this.ListBox_Click);
|
||||||
this.listBox.SelectedIndexChanged += new System.EventHandler(this.listBox_SelectedIndexChanged);
|
this.listBox.SelectedIndexChanged += new System.EventHandler(this.listBox_SelectedIndexChanged);
|
||||||
|
this.listBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listBox_KeyDown);
|
||||||
//
|
//
|
||||||
// UIComboBoxItem
|
// UIComboBoxItem
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||||
this.Controls.Add(this.listBox);
|
this.Controls.Add(this.listBox);
|
||||||
this.Name = "UIComboBoxItem";
|
this.Name = "UIComboBoxItem";
|
||||||
|
@ -69,5 +69,13 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
DoValueChanged(this, ListBox.SelectedValue);
|
DoValueChanged(this, ListBox.SelectedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void listBox_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.KeyCode == System.Windows.Forms.Keys.Enter || e.KeyCode == System.Windows.Forms.Keys.Space)
|
||||||
|
{
|
||||||
|
CloseParent();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,64 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<root>
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
6
SunnyUI/Controls/UIComboBox.Designer.cs
generated
6
SunnyUI/Controls/UIComboBox.Designer.cs
generated
@ -30,11 +30,15 @@
|
|||||||
{
|
{
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
|
// edit
|
||||||
|
//
|
||||||
|
this.edit.KeyDown += new System.Windows.Forms.KeyEventHandler(this.edit_KeyDown);
|
||||||
|
//
|
||||||
// UIComboBox
|
// UIComboBox
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||||
this.Name = "UIComboBox";
|
this.Name = "UIComboBox";
|
||||||
|
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.UIComboBox_KeyDown);
|
||||||
this.ButtonClick += new System.EventHandler(this.UIComboBox_ButtonClick);
|
this.ButtonClick += new System.EventHandler(this.UIComboBox_ButtonClick);
|
||||||
this.FontChanged += new System.EventHandler(this.UIComboBox_FontChanged);
|
this.FontChanged += new System.EventHandler(this.UIComboBox_FontChanged);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
@ -193,6 +193,11 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ShowDropDown()
|
||||||
|
{
|
||||||
|
UIComboBox_ButtonClick(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
private void UIComboBox_ButtonClick(object sender, EventArgs e)
|
private void UIComboBox_ButtonClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (Items.Count > 0)
|
if (Items.Count > 0)
|
||||||
@ -313,5 +318,21 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
return ListBox.GetItemText(item);
|
return ListBox.GetItemText(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UIComboBox_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.KeyCode == System.Windows.Forms.Keys.Enter)
|
||||||
|
{
|
||||||
|
ShowDropDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void edit_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.KeyCode == System.Windows.Forms.Keys.Enter)
|
||||||
|
{
|
||||||
|
ShowDropDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,64 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<root>
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
@ -78,11 +78,33 @@ namespace Sunny.UI
|
|||||||
listbox.ItemsAdd += Listbox_ItemsAdd;
|
listbox.ItemsAdd += Listbox_ItemsAdd;
|
||||||
listbox.ItemsRemove += Listbox_ItemsRemove;
|
listbox.ItemsRemove += Listbox_ItemsRemove;
|
||||||
listbox.ItemsInsert += Listbox_ItemsInsert;
|
listbox.ItemsInsert += Listbox_ItemsInsert;
|
||||||
|
listbox.KeyPress += Listbox_KeyPress;
|
||||||
|
listbox.KeyDown += Listbox_KeyDown;
|
||||||
|
listbox.KeyUp += Listbox_KeyUp;
|
||||||
|
|
||||||
timer.Tick += Timer_Tick;
|
timer.Tick += Timer_Tick;
|
||||||
timer.Start();
|
timer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public new event KeyPressEventHandler KeyPress;
|
||||||
|
public new event KeyEventHandler KeyDown;
|
||||||
|
public new event KeyEventHandler KeyUp;
|
||||||
|
|
||||||
|
private void Listbox_KeyUp(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
KeyUp?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Listbox_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
KeyDown?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Listbox_KeyPress(object sender, KeyPressEventArgs e)
|
||||||
|
{
|
||||||
|
KeyPress?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
|
||||||
public Control ExToolTipControl()
|
public Control ExToolTipControl()
|
||||||
{
|
{
|
||||||
return listbox;
|
return listbox;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user