上传界面显示

This commit is contained in:
2025-03-16 13:11:08 +08:00
parent ca6476b87c
commit c49c45d6e4
62 changed files with 9095 additions and 1204 deletions

View File

@ -0,0 +1,109 @@
namespace DH.UI.Model.Winform
{
partial class GridCtrl
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.chkShowGrid = new System.Windows.Forms.CheckBox();
this.tbGridValue = new System.Windows.Forms.TrackBar();
this.panel1 = new System.Windows.Forms.Panel();
this.colorDialog1 = new System.Windows.Forms.ColorDialog();
this.btnColor = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.tbGridValue)).BeginInit();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// chkShowGrid
//
this.chkShowGrid.Appearance = System.Windows.Forms.Appearance.Button;
//this.chkShowGrid.BackgroundImage = global::XKRS.UI.Model.Winform.Properties.Resources.grid;
this.chkShowGrid.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.chkShowGrid.Dock = System.Windows.Forms.DockStyle.Top;
this.chkShowGrid.Location = new System.Drawing.Point(0, 0);
this.chkShowGrid.Name = "chkShowGrid";
this.chkShowGrid.Size = new System.Drawing.Size(32, 30);
this.chkShowGrid.TabIndex = 0;
this.chkShowGrid.UseVisualStyleBackColor = true;
this.chkShowGrid.CheckedChanged += new System.EventHandler(this.chkShowGrid_CheckedChanged);
//
// tbGridValue
//
this.tbGridValue.AutoSize = false;
this.tbGridValue.Dock = System.Windows.Forms.DockStyle.Bottom;
this.tbGridValue.Location = new System.Drawing.Point(0, 21);
this.tbGridValue.Name = "tbGridValue";
this.tbGridValue.Orientation = System.Windows.Forms.Orientation.Vertical;
this.tbGridValue.Size = new System.Drawing.Size(32, 121);
this.tbGridValue.TabIndex = 1;
this.tbGridValue.TickStyle = System.Windows.Forms.TickStyle.Both;
this.tbGridValue.ValueChanged += new System.EventHandler(this.tbGridValue_ValueChanged);
//
// panel1
//
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel1.Controls.Add(this.chkShowGrid);
this.panel1.Controls.Add(this.tbGridValue);
this.panel1.Location = new System.Drawing.Point(1, 1);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(32, 142);
this.panel1.TabIndex = 2;
//
// btnColor
//
this.btnColor.BackColor = System.Drawing.Color.Red;
this.btnColor.Location = new System.Drawing.Point(4, 150);
this.btnColor.Name = "btnColor";
this.btnColor.Size = new System.Drawing.Size(25, 23);
this.btnColor.TabIndex = 3;
this.btnColor.Text = " ";
this.btnColor.UseVisualStyleBackColor = false;
this.btnColor.Click += new System.EventHandler(this.btnColor_Click);
//
// GridCtrl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.Controls.Add(this.btnColor);
this.Controls.Add(this.panel1);
this.Font = new System.Drawing.Font("Tahoma", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World, ((byte)(134)));
this.Name = "GridCtrl";
this.Size = new System.Drawing.Size(32, 192);
((System.ComponentModel.ISupportInitialize)(this.tbGridValue)).EndInit();
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.CheckBox chkShowGrid;
private System.Windows.Forms.TrackBar tbGridValue;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.ColorDialog colorDialog1;
private System.Windows.Forms.Button btnColor;
}
}

View File

@ -0,0 +1,74 @@
using System;
using System.Drawing;
using System.Windows.Forms;
namespace DH.UI.Model.Winform
{
public partial class GridCtrl : UserControl
{
public Action<bool> IsShowGridChanged { get; set; }
public Action<int> GridValueChanged { get; set; }
public Action<Color> GridColorChanged { get; set; }
public GridCtrl()
{
InitializeComponent();
IsChecked = chkShowGrid.Checked;
GridValue = tbGridValue.Value;
}
bool isChecked = false;
bool IsChecked
{
get => isChecked;
set
{
if (isChecked != value)
{
// IsShowGridChanged?.BeginInvoke(value, null, null);
Task.Run(() => IsShowGridChanged.Invoke(value));
}
isChecked = value;
}
}
int gridValue = 0;
int GridValue
{
get => gridValue;
set
{
if (gridValue != value)
{
// GridValueChanged?.BeginInvoke(value, null, null);
Task.Run(() => GridValueChanged.Invoke(value));
}
gridValue = value;
}
}
private void chkShowGrid_CheckedChanged(object sender, EventArgs e)
{
IsChecked = chkShowGrid.Checked;
}
private void tbGridValue_ValueChanged(object sender, EventArgs e)
{
GridValue = tbGridValue.Value;
}
private void btnColor_Click(object sender, EventArgs e)
{
if (colorDialog1.ShowDialog() == DialogResult.OK)
{
btnColor.BackColor = colorDialog1.Color;
// GridColorChanged?.BeginInvoke(btnColor.BackColor, null, null);
Task.Run(() => GridColorChanged.Invoke(btnColor.BackColor));
}
}
}
}

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

@ -0,0 +1,12 @@
using System.Windows.Forms;
namespace DH.UI.Model.Winform
{
public class GridCtrlHost : ToolStripControlHost
{
public GridCtrlHost(GridCtrl grid) : base(grid)
{
//Font = new System.Drawing.Font("Tahoma", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World, 134);
}
}
}

View File

@ -0,0 +1,78 @@
namespace DH.UI.Model.Winform
{
partial class IOIndicatorCtrl
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
plStatus = new Panel();
lblDesc = new Label();
SuspendLayout();
//
// plStatus
//
plStatus.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left;
plStatus.Location = new Point(0, 0);
plStatus.Margin = new Padding(4);
plStatus.Name = "plStatus";
plStatus.Size = new Size(28, 34);
plStatus.TabIndex = 0;
plStatus.Paint += plStatus_Paint;
plStatus.DoubleClick += plStatus_DoubleClick;
//
// lblDesc
//
lblDesc.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
lblDesc.AutoSize = true;
lblDesc.Font = new Font("Tahoma", 11F, FontStyle.Regular, GraphicsUnit.World);
lblDesc.Location = new Point(36, 11);
lblDesc.Margin = new Padding(4, 0, 4, 0);
lblDesc.Name = "lblDesc";
lblDesc.Size = new Size(31, 13);
lblDesc.TabIndex = 1;
lblDesc.Text = "XXXX";
lblDesc.TextAlign = ContentAlignment.MiddleLeft;
lblDesc.DoubleClick += lblDesc_DoubleClick;
//
// IOIndicatorCtrl
//
AutoScaleDimensions = new SizeF(7F, 17F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(lblDesc);
Controls.Add(plStatus);
Margin = new Padding(4);
Name = "IOIndicatorCtrl";
Size = new Size(138, 34);
ResumeLayout(false);
PerformLayout();
}
#endregion
private Panel plStatus;
private Label lblDesc;
}
}

View File

@ -0,0 +1,126 @@
using System;
using System.Drawing;
using System.Windows.Forms;
namespace DH.UI.Model.Winform
{
public partial class IOIndicatorCtrl : UserControl
{
public IOIndicatorCtrl()
{
InitializeComponent();
}
private bool isON = false;
public bool IsOn
{
get => isON;
set
{
bool? temp = isON;
isON = value;
if (temp != isON)
{
RefreshStatus();
}
}
}
private void RefreshStatus()
{
if (InvokeRequired)
{
Invoke(new Action(() => RefreshStatus()));
}
else
{
plStatus.Invalidate();
}
}
private string desc = "";
public string Desc
{
get => desc;
set
{
desc = value;
DisplayDesc();
}
}
public int Index { get; set; }
private void DisplayDesc()
{
if (InvokeRequired)
{
Invoke(new Action(() => DisplayDesc()));
}
else
{
lblDesc.Text = Desc;
}
}
readonly PointF[] regionBlink = new PointF[]
{
new PointF(5,10),
new PointF(10,13),
new PointF(12,7),
new PointF(10,5)
};
public IOIndicatorCtrl(bool _isOn, string _desc, int index = 0)
{
InitializeComponent();
IsOn = _isOn;
Desc = _desc;
Index = index;
}
/// <summary>
/// 更新绘制图标
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void plStatus_Paint(object sender, PaintEventArgs e)
{
Panel pl = sender as Panel;
Graphics g = e.Graphics;
g.Clear(SystemColors.Control);
if (IsOn)
{
g.FillEllipse(Brushes.LightGreen, pl.ClientRectangle);
}
else
{
g.FillEllipse(Brushes.Gray, pl.ClientRectangle);
}
g.FillPolygon(Brushes.White, regionBlink);
}
public event Action<string, bool, int> OnIODoubleClick;
private void lblDesc_DoubleClick(object sender, EventArgs e)
{
OnIODoubleClick?.Invoke(Name, IsOn, Index);
}
private void plStatus_DoubleClick(object sender, EventArgs e)
{
OnIODoubleClick?.Invoke(Name, IsOn, Index);
}
}
}

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>