* 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.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.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(32)))), ((int)(((byte)(32)))));
|
||||
this.listBox.ItemSelectBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
|
||||
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.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.Style = Sunny.UI.UIStyle.Custom;
|
||||
this.listBox.TabIndex = 3;
|
||||
this.listBox.Text = null;
|
||||
this.listBox.ItemClick += 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);
|
||||
//
|
||||
// UIComboBoxItem
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.Controls.Add(this.listBox);
|
||||
this.Name = "UIComboBoxItem";
|
||||
|
@ -69,5 +69,13 @@ namespace Sunny.UI
|
||||
{
|
||||
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>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<root>
|
||||
<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">
|
||||
|
6
SunnyUI/Controls/UIComboBox.Designer.cs
generated
6
SunnyUI/Controls/UIComboBox.Designer.cs
generated
@ -30,11 +30,15 @@
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// edit
|
||||
//
|
||||
this.edit.KeyDown += new System.Windows.Forms.KeyEventHandler(this.edit_KeyDown);
|
||||
//
|
||||
// UIComboBox
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.Name = "UIComboBox";
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.UIComboBox_KeyDown);
|
||||
this.ButtonClick += new System.EventHandler(this.UIComboBox_ButtonClick);
|
||||
this.FontChanged += new System.EventHandler(this.UIComboBox_FontChanged);
|
||||
this.ResumeLayout(false);
|
||||
|
@ -36,7 +36,7 @@ namespace Sunny.UI
|
||||
[DefaultEvent("SelectedIndexChanged")]
|
||||
[ToolboxItem(true)]
|
||||
[LookupBindingProperties("DataSource", "DisplayMember", "ValueMember", "SelectedValue")]
|
||||
public sealed partial class UIComboBox : UIDropControl,IToolTip
|
||||
public sealed partial class UIComboBox : UIDropControl, IToolTip
|
||||
{
|
||||
public UIComboBox()
|
||||
{
|
||||
@ -193,6 +193,11 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowDropDown()
|
||||
{
|
||||
UIComboBox_ButtonClick(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void UIComboBox_ButtonClick(object sender, EventArgs e)
|
||||
{
|
||||
if (Items.Count > 0)
|
||||
@ -313,5 +318,21 @@ namespace Sunny.UI
|
||||
{
|
||||
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>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<root>
|
||||
<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">
|
||||
|
@ -37,7 +37,7 @@ namespace Sunny.UI
|
||||
{
|
||||
[DefaultEvent("ItemClick")]
|
||||
[DefaultProperty("Items")]
|
||||
public sealed partial class UIListBox : UIPanel,IToolTip
|
||||
public sealed partial class UIListBox : UIPanel, IToolTip
|
||||
{
|
||||
private readonly ListBoxEx listbox = new ListBoxEx();
|
||||
private readonly UIScrollBar bar = new UIScrollBar();
|
||||
@ -78,11 +78,33 @@ namespace Sunny.UI
|
||||
listbox.ItemsAdd += Listbox_ItemsAdd;
|
||||
listbox.ItemsRemove += Listbox_ItemsRemove;
|
||||
listbox.ItemsInsert += Listbox_ItemsInsert;
|
||||
listbox.KeyPress += Listbox_KeyPress;
|
||||
listbox.KeyDown += Listbox_KeyDown;
|
||||
listbox.KeyUp += Listbox_KeyUp;
|
||||
|
||||
timer.Tick += Timer_Tick;
|
||||
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()
|
||||
{
|
||||
return listbox;
|
||||
|
@ -1,50 +1,50 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net5.0-windows;netcoreapp3.1;net462;net40</TargetFrameworks>
|
||||
<TargetFrameworks>net5.0-windows;netcoreapp3.1;net462;net40</TargetFrameworks>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
<ProjectGuid>{AB1CB247-E20B-4CBE-B269-570ADDD96C53}</ProjectGuid>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<RootNamespace>Sunny.UI</RootNamespace>
|
||||
<Description>SunnyUI.Net 是基于.Net Framework 4.0+、.Net Core3.1、.Net 5 框架的 C# WinForm 开源控件库、工具类库、扩展类库、多页面开发框架。</Description>
|
||||
<Copyright>CopyRight © SunnyUI.Net 2012-2021</Copyright>
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
<Version>3.0.6</Version>
|
||||
<Authors>ShenYonghua</Authors>
|
||||
<Company>SunnyUI.Net</Company>
|
||||
<PackageId>SunnyUI</PackageId>
|
||||
<PackageProjectUrl>https://gitee.com/yhuse/SunnyUI</PackageProjectUrl>
|
||||
<RepositoryUrl>https://gitee.com/yhuse/SunnyUI</RepositoryUrl>
|
||||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||
<PackageIcon>SunnyUI.png</PackageIcon>
|
||||
<ProjectGuid>{AB1CB247-E20B-4CBE-B269-570ADDD96C53}</ProjectGuid>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<RootNamespace>Sunny.UI</RootNamespace>
|
||||
<Description>SunnyUI.Net 是基于.Net Framework 4.0+、.Net Core3.1、.Net 5 框架的 C# WinForm 开源控件库、工具类库、扩展类库、多页面开发框架。</Description>
|
||||
<Copyright>CopyRight © SunnyUI.Net 2012-2021</Copyright>
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
<Version>3.0.6</Version>
|
||||
<Authors>ShenYonghua</Authors>
|
||||
<Company>SunnyUI.Net</Company>
|
||||
<PackageId>SunnyUI</PackageId>
|
||||
<PackageProjectUrl>https://gitee.com/yhuse/SunnyUI</PackageProjectUrl>
|
||||
<RepositoryUrl>https://gitee.com/yhuse/SunnyUI</RepositoryUrl>
|
||||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||
<PackageIcon>SunnyUI.png</PackageIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<OutputPath>..\Bin\</OutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
<OutputPath>..\Bin\</OutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<OutputPath>..\Bin\</OutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
<OutputPath>..\Bin\</OutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net5.0-windows|AnyCPU'">
|
||||
<Optimize>false</Optimize>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="..\LICENSE">
|
||||
<None Include="..\LICENSE">
|
||||
<Pack>True</Pack>
|
||||
<PackagePath></PackagePath>
|
||||
</None>
|
||||
<None Include="..\SunnyUI.png">
|
||||
</None>
|
||||
<None Include="..\SunnyUI.png">
|
||||
<Pack>True</Pack>
|
||||
<PackagePath></PackagePath>
|
||||
</None>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -56,13 +56,13 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SunnyUI.Common" Version="3.0.6" />
|
||||
<PackageReference Include="SunnyUI.Common" Version="3.0.6" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net40'">
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Design" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Design" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
|
||||
@ -73,9 +73,9 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
@ -83,7 +83,7 @@
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user