* UIDateTimePicker:重写下拉窗体,缩短创建时间
This commit is contained in:
parent
2026606f0c
commit
8b331f72c7
BIN
Bin/SunnyUI.dll
BIN
Bin/SunnyUI.dll
Binary file not shown.
BIN
Bin/SunnyUI.pdb
BIN
Bin/SunnyUI.pdb
Binary file not shown.
Binary file not shown.
@ -18,6 +18,7 @@
|
||||
*
|
||||
* 2020-01-01: V2.2.0 增加文件说明
|
||||
* 2020-05-29: V2.2.5 重写
|
||||
* 2020-07-04: V2.2.6 重写下拉窗体,缩短创建时间
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
@ -605,7 +606,6 @@ namespace Sunny.UI
|
||||
activeDay = iy;
|
||||
p3.Invalidate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void p3_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
|
File diff suppressed because it is too large
Load Diff
120
SunnyUI/Controls/DropItem/UIDateTimeItem.resx
Normal file
120
SunnyUI/Controls/DropItem/UIDateTimeItem.resx
Normal 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>
|
@ -70,6 +70,7 @@ namespace Sunny.UI
|
||||
{
|
||||
if (e.KeyData == Keys.Enter)
|
||||
{
|
||||
base.OnKeyDown(e);
|
||||
EnterKeyPress?.Invoke(this, e);
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ namespace Sunny.UI
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
DoEnter?.Invoke(sender,e);
|
||||
DoEnter?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
KeyDown?.Invoke(sender, e);
|
||||
|
@ -20,6 +20,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
@ -28,6 +29,13 @@ namespace Sunny.UI
|
||||
{
|
||||
public static class GDIEx
|
||||
{
|
||||
public static Color Alpha(this Color color, int alpha)
|
||||
{
|
||||
alpha = Math.Max(0, alpha);
|
||||
alpha = Math.Min(255, alpha);
|
||||
return Color.FromArgb(alpha, color);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 九宫切图背景填充,#,http://st233.com/blog.php?id=24
|
||||
/// 例如按钮是图片分成九个区域 然后只需要将四角填充到目标区域 其余的拉伸就可以了
|
||||
@ -62,30 +70,32 @@ namespace Sunny.UI
|
||||
new Rectangle(angleSize, angleSize, img.Width - angleSize * 2, img.Height - angleSize * 2), GraphicsUnit.Pixel);
|
||||
}
|
||||
|
||||
public static void DrawImageWithNineCut(Graphics g, Image img, Rectangle rect, int left, int right, int top, int bottom)
|
||||
public static void DrawImageWithNineCut(this Graphics g, Image img, Rectangle rect, int left, int right, int top, int bottom,int zoom=1)
|
||||
{
|
||||
zoom = Math.Max(1, zoom);
|
||||
|
||||
//填充四个角
|
||||
g.DrawImage(img, new Rectangle(rect.X, rect.Y, left, top),
|
||||
g.DrawImage(img, new Rectangle(rect.X*zoom, rect.Y * zoom, left * zoom, top * zoom),
|
||||
new Rectangle(0, 0, left, top), GraphicsUnit.Pixel);
|
||||
g.DrawImage(img, new Rectangle(rect.Right - right, rect.Y, right, top),
|
||||
g.DrawImage(img, new Rectangle((rect.Right - right) * zoom, rect.Y * zoom, right * zoom, top * zoom),
|
||||
new Rectangle(img.Width - right, 0, right, top), GraphicsUnit.Pixel);
|
||||
g.DrawImage(img, new Rectangle(rect.X, rect.Bottom - bottom, left, bottom),
|
||||
g.DrawImage(img, new Rectangle(rect.X * zoom, (rect.Bottom - bottom) * zoom, left * zoom, bottom * zoom),
|
||||
new Rectangle(0, img.Height - bottom, left, bottom), GraphicsUnit.Pixel);
|
||||
g.DrawImage(img, new Rectangle(rect.Right - right, rect.Bottom - bottom, right, bottom),
|
||||
g.DrawImage(img, new Rectangle((rect.Right - right) * zoom, (rect.Bottom - bottom) * zoom, right * zoom, bottom * zoom),
|
||||
new Rectangle(img.Width - right, img.Height - bottom, right, bottom), GraphicsUnit.Pixel);
|
||||
|
||||
//四边
|
||||
g.DrawImage(img, new Rectangle(rect.X + left, rect.Y, rect.Width - left - right, top),
|
||||
g.DrawImage(img, new Rectangle((rect.X + left) * zoom, rect.Y * zoom, (rect.Width - left - right) * zoom, top * zoom),
|
||||
new Rectangle(left, 0, img.Width - left - right, top), GraphicsUnit.Pixel);
|
||||
g.DrawImage(img, new Rectangle(rect.X, top, left, rect.Height - top - bottom),
|
||||
g.DrawImage(img, new Rectangle(rect.X * zoom, top * zoom, left * zoom, (rect.Height - top - bottom) * zoom),
|
||||
new Rectangle(0, top, left, img.Height - top - bottom), GraphicsUnit.Pixel);
|
||||
g.DrawImage(img, new Rectangle(rect.Right - right, top, right, rect.Height - top - bottom),
|
||||
g.DrawImage(img, new Rectangle((rect.Right - right) * zoom, top * zoom, right * zoom, (rect.Height - top - bottom) * zoom),
|
||||
new Rectangle(img.Width - right, top, right, img.Height - top - bottom), GraphicsUnit.Pixel);
|
||||
g.DrawImage(img, new Rectangle(rect.X + left, rect.Bottom - bottom, rect.Width - left - right, bottom),
|
||||
g.DrawImage(img, new Rectangle((rect.X + left) * zoom, (rect.Bottom - bottom) * zoom, (rect.Width - left - right) * zoom, bottom * zoom),
|
||||
new Rectangle(left, img.Height - bottom, img.Width - left - right, bottom), GraphicsUnit.Pixel);
|
||||
|
||||
//中间
|
||||
g.DrawImage(img, new Rectangle(rect.X + left, rect.Y + top, rect.Width - left - right, rect.Height - top - bottom),
|
||||
g.DrawImage(img, new Rectangle((rect.X + left) * zoom, (rect.Y + top) * zoom, (rect.Width - left - right) * zoom, (rect.Height - top - bottom) * zoom),
|
||||
new Rectangle(left, top, img.Width - left - right, img.Height - top - bottom), GraphicsUnit.Pixel);
|
||||
}
|
||||
|
||||
|
@ -474,6 +474,9 @@
|
||||
<Compile Include="Units\UXmlConfig.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Controls\DropItem\UIDateTimeItem.resx">
|
||||
<DependentUpon>UIDateTimeItem.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\UINotifier.resx">
|
||||
<DependentUpon>UINotifier.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
Loading…
x
Reference in New Issue
Block a user