* UIDateTimePicker,UITimePicker:更改滚轮选择时间的方向

This commit is contained in:
Sunny 2020-09-16 22:57:19 +08:00
parent 81c8b43879
commit 94d867317b
7 changed files with 160 additions and 36 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -268,7 +268,7 @@ namespace Sunny.UI
this.tabPage2.Controls.Add(this.p2);
this.tabPage2.Location = new System.Drawing.Point(0, 40);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(284, 164);
this.tabPage2.Size = new System.Drawing.Size(450, 230);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "tabPage2";
this.tabPage2.UseVisualStyleBackColor = true;
@ -282,7 +282,7 @@ namespace Sunny.UI
this.p2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.p2.Name = "p2";
this.p2.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.p2.Size = new System.Drawing.Size(284, 164);
this.p2.Size = new System.Drawing.Size(450, 230);
this.p2.Style = Sunny.UI.UIStyle.Custom;
this.p2.TabIndex = 1;
this.p2.Text = null;
@ -295,7 +295,7 @@ namespace Sunny.UI
this.tabPage3.Controls.Add(this.p3);
this.tabPage3.Location = new System.Drawing.Point(0, 40);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(284, 164);
this.tabPage3.Size = new System.Drawing.Size(450, 230);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "tabPage3";
this.tabPage3.UseVisualStyleBackColor = true;
@ -309,7 +309,7 @@ namespace Sunny.UI
this.p3.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.p3.Name = "p3";
this.p3.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.p3.Size = new System.Drawing.Size(284, 164);
this.p3.Size = new System.Drawing.Size(450, 230);
this.p3.Style = Sunny.UI.UIStyle.Custom;
this.p3.TabIndex = 2;
this.p3.Text = null;
@ -505,7 +505,7 @@ namespace Sunny.UI
this.mm2.Symbol = 61703;
this.mm2.TabIndex = 27;
this.mm2.Tag = "5";
this.mm2.Click += new System.EventHandler(this.mm1_Click);
this.mm2.Click += new System.EventHandler(this.mm2_Click);
//
// h2
//
@ -574,7 +574,7 @@ namespace Sunny.UI
this.mm1.Symbol = 61702;
this.mm1.TabIndex = 24;
this.mm1.Tag = "2";
this.mm1.Click += new System.EventHandler(this.mm2_Click);
this.mm1.Click += new System.EventHandler(this.mm1_Click);
//
// h1
//
@ -913,21 +913,6 @@ namespace Sunny.UI
private void UITimeItem_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Delta < 0)
{
if (new Rectangle(ht.Left, ht.Top, ht.Width, hb.Bottom - ht.Top).Contains(e.X, e.Y))
{
h1.PerformClick();
}
else if (new Rectangle(mt.Left, mt.Top, ht.Width, hb.Bottom - ht.Top).Contains(e.X, e.Y))
{
mm1.PerformClick();
}
else if (new Rectangle(st.Left, st.Top, ht.Width, hb.Bottom - ht.Top).Contains(e.X, e.Y))
{
s1.PerformClick();
}
}
else if (e.Delta > 0)
{
if (new Rectangle(ht.Left, ht.Top, ht.Width, hb.Bottom - ht.Top).Contains(e.X, e.Y))
{
@ -942,6 +927,21 @@ namespace Sunny.UI
s2.PerformClick();
}
}
else if (e.Delta > 0)
{
if (new Rectangle(ht.Left, ht.Top, ht.Width, hb.Bottom - ht.Top).Contains(e.X, e.Y))
{
h1.PerformClick();
}
else if (new Rectangle(mt.Left, mt.Top, ht.Width, hb.Bottom - ht.Top).Contains(e.X, e.Y))
{
mm1.PerformClick();
}
else if (new Rectangle(st.Left, st.Top, ht.Width, hb.Bottom - ht.Top).Contains(e.X, e.Y))
{
s1.PerformClick();
}
}
}
private void h1_Click(object sender, EventArgs e)
@ -1202,6 +1202,7 @@ namespace Sunny.UI
int id = x + y * 7;
if (id < 0 || id >= 42) return;
date = days[id].Date;
date = new DateTime(date.Year, date.Month, date.Day, Hour, Minute, Second);
DoValueChanged(this, Date);
CloseParent();
}

View File

@ -0,0 +1,120 @@
<?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">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -419,21 +419,6 @@ namespace Sunny.UI
private void UITimeItem_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Delta < 0)
{
if (new Rectangle(ht.Left, ht.Top, ht.Width, hb.Bottom - ht.Top).Contains(e.X, e.Y))
{
h1.PerformClick();
}
else if (new Rectangle(mt.Left, mt.Top, ht.Width, hb.Bottom - ht.Top).Contains(e.X, e.Y))
{
m1.PerformClick();
}
else if (new Rectangle(st.Left, st.Top, ht.Width, hb.Bottom - ht.Top).Contains(e.X, e.Y))
{
s1.PerformClick();
}
}
else if (e.Delta > 0)
{
if (new Rectangle(ht.Left, ht.Top, ht.Width, hb.Bottom - ht.Top).Contains(e.X, e.Y))
{
@ -448,6 +433,21 @@ namespace Sunny.UI
s2.PerformClick();
}
}
else if (e.Delta > 0)
{
if (new Rectangle(ht.Left, ht.Top, ht.Width, hb.Bottom - ht.Top).Contains(e.X, e.Y))
{
h1.PerformClick();
}
else if (new Rectangle(mt.Left, mt.Top, ht.Width, hb.Bottom - ht.Top).Contains(e.X, e.Y))
{
m1.PerformClick();
}
else if (new Rectangle(st.Left, st.Top, ht.Width, hb.Bottom - ht.Top).Contains(e.X, e.Y))
{
s1.PerformClick();
}
}
}
private DateTime time;

View File

@ -495,6 +495,9 @@
<Compile Include="Units\UXmlConfig.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Controls\DropItem\UIDateTimeItem.resx">
<DependentUpon>UIDateTimeItem.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\UIEditForm.resx">
<DependentUpon>UIEditForm.cs</DependentUpon>
</EmbeddedResource>