* UIComboBox: 增加了SelectionChangeCommitted事件,下拉框显示鼠标点击条目时响应
This commit is contained in:
parent
2d98153089
commit
88bce81140
52
SunnyUI/Controls/DropItem/UIComboBoxItem.Designer.cs
generated
52
SunnyUI/Controls/DropItem/UIComboBoxItem.Designer.cs
generated
@ -28,38 +28,38 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.listBox = new Sunny.UI.UIListBox();
|
||||
this.SuspendLayout();
|
||||
listBox = new UIListBox();
|
||||
SuspendLayout();
|
||||
//
|
||||
// listBox
|
||||
//
|
||||
this.listBox.BackColor = System.Drawing.Color.Transparent;
|
||||
this.listBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.listBox.FillColor = System.Drawing.Color.White;
|
||||
this.listBox.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.listBox.FormatString = "";
|
||||
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.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.Padding = new System.Windows.Forms.Padding(2);
|
||||
this.listBox.Radius = 0;
|
||||
this.listBox.Size = new System.Drawing.Size(184, 210);
|
||||
this.listBox.TabIndex = 3;
|
||||
this.listBox.Text = null;
|
||||
this.listBox.Click += new System.EventHandler(this.ListBox_Click);
|
||||
this.listBox.SelectedIndexChanged += new System.EventHandler(this.listBox_SelectedIndexChanged);
|
||||
this.listBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listBox_KeyDown);
|
||||
listBox.BackColor = System.Drawing.Color.Transparent;
|
||||
listBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
listBox.FillColor = System.Drawing.Color.White;
|
||||
listBox.Font = new System.Drawing.Font("宋体", 12F);
|
||||
listBox.HoverColor = System.Drawing.Color.FromArgb(155, 200, 255);
|
||||
listBox.ItemSelectForeColor = System.Drawing.Color.FromArgb(235, 243, 255);
|
||||
listBox.Location = new System.Drawing.Point(0, 0);
|
||||
listBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
listBox.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
listBox.Name = "listBox";
|
||||
listBox.Padding = new System.Windows.Forms.Padding(2);
|
||||
listBox.Radius = 0;
|
||||
listBox.ShowText = false;
|
||||
listBox.Size = new System.Drawing.Size(184, 210);
|
||||
listBox.TabIndex = 3;
|
||||
listBox.Text = null;
|
||||
listBox.KeyDown += listBox_KeyDown;
|
||||
listBox.Click += ListBox_Click;
|
||||
listBox.SelectedIndexChanged += listBox_SelectedIndexChanged;
|
||||
//
|
||||
// UIComboBoxItem
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.Controls.Add(this.listBox);
|
||||
this.Name = "UIComboBoxItem";
|
||||
this.Size = new System.Drawing.Size(184, 210);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
Controls.Add(listBox);
|
||||
Name = "UIComboBoxItem";
|
||||
Size = new System.Drawing.Size(184, 210);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -1,4 +1,64 @@
|
||||
<root>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
|
@ -40,6 +40,7 @@
|
||||
* 2023-08-11: V3.4.1 Items.Clear后,DropDownStyle为DropDown时,不清空Text
|
||||
* 2023-12-26: V3.6.2 增加下拉界面的滚动条设置
|
||||
* 2024-01-27: V3.6.3 修复在窗体构造函数设置SelectedIndex报错
|
||||
* 2024-10-28: V3.7.2 增加了SelectionChangeCommitted事件,下拉框显示鼠标点击条目时响应
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
@ -71,6 +72,7 @@ namespace Sunny.UI
|
||||
ListBox.SelectedValueChanged += ListBox_SelectedValueChanged;
|
||||
ListBox.ItemsClear += ListBox_ItemsClear;
|
||||
ListBox.ItemsRemove += ListBox_ItemsRemove;
|
||||
ListBox.MouseClick += ListBox_MouseClick;
|
||||
|
||||
filterForm.BeforeListClick += ListBox_Click;
|
||||
|
||||
@ -82,6 +84,19 @@ namespace Sunny.UI
|
||||
CreateInstance();
|
||||
}
|
||||
|
||||
private void ListBox_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
//SelectionChangeCommitted
|
||||
UIListBox listBox = (UIListBox)sender;
|
||||
int index = listBox.IndexFromPoint(e.X, e.Y);
|
||||
if (index != -1)
|
||||
{
|
||||
SelectionChangeCommitted?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler SelectionChangeCommitted;
|
||||
|
||||
[Browsable(false)]
|
||||
public override string[] FormTranslatorProperties { get; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user