* UIDoubleUpDown,UIIntegerUpDown:增加双击可编辑数值
This commit is contained in:
parent
9a30ef3670
commit
6504f994db
BIN
Bin/SunnyUI.dll
BIN
Bin/SunnyUI.dll
Binary file not shown.
@ -23,6 +23,8 @@
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
@ -36,6 +38,19 @@ namespace Sunny.UI
|
||||
{
|
||||
InitializeComponent();
|
||||
ShowText = false;
|
||||
edit.Type = UITextBox.UIEditType.Double;
|
||||
edit.Parent = pnlValue;
|
||||
edit.Visible = false;
|
||||
edit.BorderStyle = BorderStyle.None;
|
||||
edit.TextChanged += Edit_TextChanged;
|
||||
}
|
||||
|
||||
private void Edit_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (edit != null && edit.Visible)
|
||||
{
|
||||
Value = edit.Text.ToDouble();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnFontChanged(EventArgs e)
|
||||
@ -46,7 +61,7 @@ namespace Sunny.UI
|
||||
|
||||
public event OnValueChanged ValueChanged;
|
||||
|
||||
private double _value = 0;
|
||||
private double _value;
|
||||
|
||||
[DefaultValue(0)]
|
||||
[Description("选中数值"), Category("SunnyUI")]
|
||||
@ -73,20 +88,27 @@ namespace Sunny.UI
|
||||
public double Step
|
||||
{
|
||||
get => step;
|
||||
set
|
||||
{
|
||||
step = Math.Abs(value);
|
||||
}
|
||||
set => step = Math.Abs(value);
|
||||
}
|
||||
|
||||
private void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
Value += Step;
|
||||
if (edit.Visible)
|
||||
{
|
||||
edit.Visible = false;
|
||||
pnlValue.FillColor = pnlColor;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnDec_Click(object sender, EventArgs e)
|
||||
{
|
||||
Value -= Step;
|
||||
if (edit.Visible)
|
||||
{
|
||||
edit.Visible = false;
|
||||
pnlValue.FillColor = pnlColor;
|
||||
}
|
||||
}
|
||||
|
||||
private double _maximum = double.MaxValue;
|
||||
@ -104,6 +126,7 @@ namespace Sunny.UI
|
||||
_minimum = _maximum;
|
||||
|
||||
Value = CheckMaxMin(Value);
|
||||
edit.MaxValue = _maximum;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
@ -120,6 +143,7 @@ namespace Sunny.UI
|
||||
_maximum = _minimum;
|
||||
|
||||
Value = CheckMaxMin(Value);
|
||||
edit.MinValue = _minimum;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
@ -155,6 +179,7 @@ namespace Sunny.UI
|
||||
{
|
||||
hasMaximum = value;
|
||||
Value = CheckMaxMin(Value);
|
||||
edit.HasMaxValue = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
@ -171,9 +196,26 @@ namespace Sunny.UI
|
||||
{
|
||||
hasMinimum = value;
|
||||
Value = CheckMaxMin(Value);
|
||||
edit.HasMinValue = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private readonly UIEdit edit = new UIEdit();
|
||||
private Color pnlColor;
|
||||
private void pnlValue_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
edit.Left = 1;
|
||||
edit.Top = (pnlValue.Height - edit.Height) / 2;
|
||||
edit.Width = pnlValue.Width - 2;
|
||||
pnlColor = pnlValue.FillColor;
|
||||
pnlValue.FillColor = Color.White;
|
||||
edit.TextAlign = HorizontalAlignment.Center;
|
||||
edit.Text = pnlValue.Text;
|
||||
edit.DecLength = Decimal;
|
||||
edit.Visible = true;
|
||||
edit.BringToFront();
|
||||
}
|
||||
}
|
||||
}
|
48
SunnyUI/Controls/UIDoubleUpDown.designer.cs
generated
48
SunnyUI/Controls/UIDoubleUpDown.designer.cs
generated
@ -37,31 +37,17 @@
|
||||
//
|
||||
this.btnDec.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnDec.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.btnDec.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
|
||||
this.btnDec.FillDisableColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.btnDec.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(111)))), ((int)(((byte)(168)))), ((int)(((byte)(255)))));
|
||||
this.btnDec.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(131)))), ((int)(((byte)(229)))));
|
||||
this.btnDec.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnDec.ForeColor = System.Drawing.Color.White;
|
||||
this.btnDec.ForeDisableColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(103)))));
|
||||
this.btnDec.ForeHoverColor = System.Drawing.Color.White;
|
||||
this.btnDec.ForePressColor = System.Drawing.Color.White;
|
||||
this.btnDec.ImageInterval = 1;
|
||||
this.btnDec.Location = new System.Drawing.Point(0, 0);
|
||||
this.btnDec.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.btnDec.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnDec.Name = "btnDec";
|
||||
this.btnDec.Padding = new System.Windows.Forms.Padding(26, 0, 0, 0);
|
||||
this.btnDec.RadiusSides = ((Sunny.UI.UICornerRadiusSides)((Sunny.UI.UICornerRadiusSides.LeftTop | Sunny.UI.UICornerRadiusSides.LeftBottom)));
|
||||
this.btnDec.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
|
||||
this.btnDec.RectDisableColor = System.Drawing.Color.FromArgb(((int)(((byte)(173)))), ((int)(((byte)(178)))), ((int)(((byte)(181)))));
|
||||
this.btnDec.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(111)))), ((int)(((byte)(168)))), ((int)(((byte)(255)))));
|
||||
this.btnDec.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(131)))), ((int)(((byte)(229)))));
|
||||
this.btnDec.Size = new System.Drawing.Size(29, 29);
|
||||
this.btnDec.Style = Sunny.UI.UIStyle.Blue;
|
||||
this.btnDec.Symbol = 61544;
|
||||
this.btnDec.TabIndex = 0;
|
||||
this.btnDec.Text = null;
|
||||
this.btnDec.TipsFont = new System.Drawing.Font("Microsoft Sans Serif", 9F);
|
||||
this.btnDec.TipsText = null;
|
||||
this.btnDec.Click += new System.EventHandler(this.btnDec_Click);
|
||||
//
|
||||
@ -69,63 +55,43 @@
|
||||
//
|
||||
this.btnAdd.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnAdd.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.btnAdd.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
|
||||
this.btnAdd.FillDisableColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.btnAdd.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(111)))), ((int)(((byte)(168)))), ((int)(((byte)(255)))));
|
||||
this.btnAdd.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(131)))), ((int)(((byte)(229)))));
|
||||
this.btnAdd.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnAdd.ForeColor = System.Drawing.Color.White;
|
||||
this.btnAdd.ForeDisableColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(103)))));
|
||||
this.btnAdd.ForeHoverColor = System.Drawing.Color.White;
|
||||
this.btnAdd.ForePressColor = System.Drawing.Color.White;
|
||||
this.btnAdd.ImageInterval = 1;
|
||||
this.btnAdd.Location = new System.Drawing.Point(87, 0);
|
||||
this.btnAdd.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.btnAdd.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnAdd.Name = "btnAdd";
|
||||
this.btnAdd.Padding = new System.Windows.Forms.Padding(26, 0, 0, 0);
|
||||
this.btnAdd.RadiusSides = ((Sunny.UI.UICornerRadiusSides)((Sunny.UI.UICornerRadiusSides.RightTop | Sunny.UI.UICornerRadiusSides.RightBottom)));
|
||||
this.btnAdd.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
|
||||
this.btnAdd.RectDisableColor = System.Drawing.Color.FromArgb(((int)(((byte)(173)))), ((int)(((byte)(178)))), ((int)(((byte)(181)))));
|
||||
this.btnAdd.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(111)))), ((int)(((byte)(168)))), ((int)(((byte)(255)))));
|
||||
this.btnAdd.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(131)))), ((int)(((byte)(229)))));
|
||||
this.btnAdd.Size = new System.Drawing.Size(29, 29);
|
||||
this.btnAdd.Style = Sunny.UI.UIStyle.Blue;
|
||||
this.btnAdd.Symbol = 61543;
|
||||
this.btnAdd.TabIndex = 1;
|
||||
this.btnAdd.Text = null;
|
||||
this.btnAdd.TipsFont = new System.Drawing.Font("Microsoft Sans Serif", 9F);
|
||||
this.btnAdd.TipsText = null;
|
||||
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
|
||||
//
|
||||
// pnlValue
|
||||
//
|
||||
this.pnlValue.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pnlValue.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
||||
this.pnlValue.FillDisableColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.pnlValue.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.pnlValue.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(32)))), ((int)(((byte)(32)))));
|
||||
this.pnlValue.ForeDisableColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(103)))));
|
||||
this.pnlValue.Location = new System.Drawing.Point(29, 0);
|
||||
this.pnlValue.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.pnlValue.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.pnlValue.Name = "pnlValue";
|
||||
this.pnlValue.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
|
||||
this.pnlValue.RectDisableColor = System.Drawing.Color.FromArgb(((int)(((byte)(173)))), ((int)(((byte)(178)))), ((int)(((byte)(181)))));
|
||||
this.pnlValue.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
|
||||
this.pnlValue.RectSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((System.Windows.Forms.ToolStripStatusLabelBorderSides.Top | System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom)));
|
||||
this.pnlValue.RadiusSides = UICornerRadiusSides.None;
|
||||
this.pnlValue.Size = new System.Drawing.Size(58, 29);
|
||||
this.pnlValue.Style = Sunny.UI.UIStyle.Blue;
|
||||
this.pnlValue.TabIndex = 2;
|
||||
this.pnlValue.Text = "0";
|
||||
this.pnlValue.DoubleClick += new System.EventHandler(this.pnlValue_DoubleClick);
|
||||
//
|
||||
// UIIntegerUpDown
|
||||
// UIDoubleUpDown
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.Controls.Add(this.pnlValue);
|
||||
this.Controls.Add(this.btnAdd);
|
||||
this.Controls.Add(this.btnDec);
|
||||
this.MinimumSize = new System.Drawing.Size(100, 0);
|
||||
this.Name = "UIIntegerUpDown";
|
||||
this.Name = "UIDoubleUpDown";
|
||||
this.Size = new System.Drawing.Size(116, 29);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
|
120
SunnyUI/Controls/UIDoubleUpDown.resx
Normal file
120
SunnyUI/Controls/UIDoubleUpDown.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>
|
@ -23,6 +23,8 @@
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
@ -36,6 +38,19 @@ namespace Sunny.UI
|
||||
{
|
||||
InitializeComponent();
|
||||
ShowText = false;
|
||||
edit.Type = UITextBox.UIEditType.Integer;
|
||||
edit.Parent = pnlValue;
|
||||
edit.Visible = false;
|
||||
edit.BorderStyle = BorderStyle.None;
|
||||
edit.TextChanged += Edit_TextChanged;
|
||||
}
|
||||
|
||||
private void Edit_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (edit != null && edit.Visible)
|
||||
{
|
||||
Value = edit.Text.ToInt();
|
||||
}
|
||||
}
|
||||
|
||||
public event OnValueChanged ValueChanged;
|
||||
@ -69,17 +84,27 @@ namespace Sunny.UI
|
||||
public int Step
|
||||
{
|
||||
get => step;
|
||||
set { step = Math.Max(1, value); }
|
||||
set => step = Math.Max(1, value);
|
||||
}
|
||||
|
||||
private void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
Value += Step;
|
||||
if (edit.Visible)
|
||||
{
|
||||
edit.Visible = false;
|
||||
pnlValue.FillColor = pnlColor;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnDec_Click(object sender, EventArgs e)
|
||||
{
|
||||
Value -= Step;
|
||||
if (edit.Visible)
|
||||
{
|
||||
edit.Visible = false;
|
||||
pnlValue.FillColor = pnlColor;
|
||||
}
|
||||
}
|
||||
|
||||
private int _maximum = int.MaxValue;
|
||||
@ -97,6 +122,7 @@ namespace Sunny.UI
|
||||
_minimum = _maximum;
|
||||
|
||||
Value = CheckMaxMin(Value);
|
||||
edit.MaxValue = _maximum;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
@ -113,6 +139,7 @@ namespace Sunny.UI
|
||||
_maximum = _minimum;
|
||||
|
||||
Value = CheckMaxMin(Value);
|
||||
edit.MinValue = _maximum;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
@ -148,6 +175,7 @@ namespace Sunny.UI
|
||||
{
|
||||
hasMaximum = value;
|
||||
Value = CheckMaxMin(Value);
|
||||
edit.HasMaxValue = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
@ -164,9 +192,25 @@ namespace Sunny.UI
|
||||
{
|
||||
hasMinimum = value;
|
||||
Value = CheckMaxMin(Value);
|
||||
edit.HasMinValue = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private readonly UIEdit edit = new UIEdit();
|
||||
private Color pnlColor;
|
||||
private void pnlValue_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
edit.Left = 1;
|
||||
edit.Top = (pnlValue.Height - edit.Height) / 2;
|
||||
edit.Width = pnlValue.Width - 2;
|
||||
pnlColor = pnlValue.FillColor;
|
||||
pnlValue.FillColor = Color.White;
|
||||
edit.TextAlign = HorizontalAlignment.Center;
|
||||
edit.Text = pnlValue.Text;
|
||||
edit.Visible = true;
|
||||
edit.BringToFront();
|
||||
}
|
||||
}
|
||||
}
|
44
SunnyUI/Controls/UIIntegerUpDown.designer.cs
generated
44
SunnyUI/Controls/UIIntegerUpDown.designer.cs
generated
@ -37,31 +37,17 @@
|
||||
//
|
||||
this.btnDec.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnDec.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.btnDec.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
|
||||
this.btnDec.FillDisableColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.btnDec.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(111)))), ((int)(((byte)(168)))), ((int)(((byte)(255)))));
|
||||
this.btnDec.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(131)))), ((int)(((byte)(229)))));
|
||||
this.btnDec.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnDec.ForeColor = System.Drawing.Color.White;
|
||||
this.btnDec.ForeDisableColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(103)))));
|
||||
this.btnDec.ForeHoverColor = System.Drawing.Color.White;
|
||||
this.btnDec.ForePressColor = System.Drawing.Color.White;
|
||||
this.btnDec.ImageInterval = 1;
|
||||
this.btnDec.Location = new System.Drawing.Point(0, 0);
|
||||
this.btnDec.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.btnDec.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnDec.Name = "btnDec";
|
||||
this.btnDec.Padding = new System.Windows.Forms.Padding(26, 0, 0, 0);
|
||||
this.btnDec.RadiusSides = ((Sunny.UI.UICornerRadiusSides)((Sunny.UI.UICornerRadiusSides.LeftTop | Sunny.UI.UICornerRadiusSides.LeftBottom)));
|
||||
this.btnDec.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
|
||||
this.btnDec.RectDisableColor = System.Drawing.Color.FromArgb(((int)(((byte)(173)))), ((int)(((byte)(178)))), ((int)(((byte)(181)))));
|
||||
this.btnDec.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(111)))), ((int)(((byte)(168)))), ((int)(((byte)(255)))));
|
||||
this.btnDec.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(131)))), ((int)(((byte)(229)))));
|
||||
this.btnDec.Size = new System.Drawing.Size(29, 29);
|
||||
this.btnDec.Style = Sunny.UI.UIStyle.Blue;
|
||||
this.btnDec.Symbol = 61544;
|
||||
this.btnDec.TabIndex = 0;
|
||||
this.btnDec.Text = null;
|
||||
this.btnDec.TipsFont = new System.Drawing.Font("Microsoft Sans Serif", 9F);
|
||||
this.btnDec.TipsText = null;
|
||||
this.btnDec.Click += new System.EventHandler(this.btnDec_Click);
|
||||
//
|
||||
@ -69,57 +55,37 @@
|
||||
//
|
||||
this.btnAdd.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnAdd.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.btnAdd.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
|
||||
this.btnAdd.FillDisableColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.btnAdd.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(111)))), ((int)(((byte)(168)))), ((int)(((byte)(255)))));
|
||||
this.btnAdd.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(131)))), ((int)(((byte)(229)))));
|
||||
this.btnAdd.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnAdd.ForeColor = System.Drawing.Color.White;
|
||||
this.btnAdd.ForeDisableColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(103)))));
|
||||
this.btnAdd.ForeHoverColor = System.Drawing.Color.White;
|
||||
this.btnAdd.ForePressColor = System.Drawing.Color.White;
|
||||
this.btnAdd.ImageInterval = 1;
|
||||
this.btnAdd.Location = new System.Drawing.Point(87, 0);
|
||||
this.btnAdd.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.btnAdd.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnAdd.Name = "btnAdd";
|
||||
this.btnAdd.Padding = new System.Windows.Forms.Padding(26, 0, 0, 0);
|
||||
this.btnAdd.RadiusSides = ((Sunny.UI.UICornerRadiusSides)((Sunny.UI.UICornerRadiusSides.RightTop | Sunny.UI.UICornerRadiusSides.RightBottom)));
|
||||
this.btnAdd.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
|
||||
this.btnAdd.RectDisableColor = System.Drawing.Color.FromArgb(((int)(((byte)(173)))), ((int)(((byte)(178)))), ((int)(((byte)(181)))));
|
||||
this.btnAdd.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(111)))), ((int)(((byte)(168)))), ((int)(((byte)(255)))));
|
||||
this.btnAdd.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(131)))), ((int)(((byte)(229)))));
|
||||
this.btnAdd.Size = new System.Drawing.Size(29, 29);
|
||||
this.btnAdd.Style = Sunny.UI.UIStyle.Blue;
|
||||
this.btnAdd.Symbol = 61543;
|
||||
this.btnAdd.TabIndex = 1;
|
||||
this.btnAdd.Text = null;
|
||||
this.btnAdd.TipsFont = new System.Drawing.Font("Microsoft Sans Serif", 9F);
|
||||
this.btnAdd.TipsText = null;
|
||||
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
|
||||
//
|
||||
// pnlValue
|
||||
//
|
||||
this.pnlValue.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pnlValue.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
||||
this.pnlValue.FillDisableColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.pnlValue.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.pnlValue.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(32)))), ((int)(((byte)(32)))));
|
||||
this.pnlValue.ForeDisableColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(103)))));
|
||||
this.pnlValue.Location = new System.Drawing.Point(29, 0);
|
||||
this.pnlValue.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.pnlValue.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.pnlValue.Name = "pnlValue";
|
||||
this.pnlValue.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
|
||||
this.pnlValue.RectDisableColor = System.Drawing.Color.FromArgb(((int)(((byte)(173)))), ((int)(((byte)(178)))), ((int)(((byte)(181)))));
|
||||
this.pnlValue.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
|
||||
this.pnlValue.RectSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((System.Windows.Forms.ToolStripStatusLabelBorderSides.Top | System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom)));
|
||||
this.pnlValue.RadiusSides = UICornerRadiusSides.None;
|
||||
this.pnlValue.Size = new System.Drawing.Size(58, 29);
|
||||
this.pnlValue.Style = Sunny.UI.UIStyle.Blue;
|
||||
this.pnlValue.TabIndex = 2;
|
||||
this.pnlValue.Text = "0";
|
||||
this.pnlValue.DoubleClick += new System.EventHandler(this.pnlValue_DoubleClick);
|
||||
//
|
||||
// UIIntegerUpDown
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.Controls.Add(this.pnlValue);
|
||||
this.Controls.Add(this.btnAdd);
|
||||
|
120
SunnyUI/Controls/UIIntegerUpDown.resx
Normal file
120
SunnyUI/Controls/UIIntegerUpDown.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>
|
@ -534,6 +534,12 @@
|
||||
<Compile Include="Win32\Win32.User.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Controls\UIDoubleUpDown.resx">
|
||||
<DependentUpon>UIDoubleUpDown.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Controls\UIIntegerUpDown.resx">
|
||||
<DependentUpon>UIIntegerUpDown.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\UIDataGridViewForm.resx">
|
||||
<DependentUpon>UIDataGridViewForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
Loading…
x
Reference in New Issue
Block a user