Commit 4feea31d 顾剑亮

上传代码

0 个父辈
正在显示 258 个修改的文件 包含 4875 行增加0 行删除
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
/.vs/Theme/v16
{
"CurrentProjectSetting": null
}
\ No newline at end of file
此文件类型无法预览
{
"ExpandedNodes": [
""
],
"PreviewInSolutionExplorer": false
}
\ No newline at end of file
此文件类型无法预览
using System;
using System.Xml;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Drawing;
namespace Asa.Face
{
/// <summary>
/// 多语言类
/// </summary>
public class Language
{
private XmlDocument _doc;
private string[] _file; //XML文件的路径
private int _index = -1;
private Dictionary<string, string> DialogText = new Dictionary<string, string>();
private List<ClsLangForm> langForm = new List<ClsLangForm>();
/// <summary>
/// 多语言
/// </summary>
/// <param name="path"></param>
public Language(string path)
{
if (!System.IO.Directory.Exists(path))
System.IO.Directory.CreateDirectory(path);
_file = System.IO.Directory.GetFiles(path, "*.xml");
_doc = new XmlDocument();
Name = new string[_file.Length];
for (int i = 0; i < _file.Length; i++)
{
_doc.Load(_file[i]);
Name[i] = _doc.LastChild.Attributes["Name"].Value;
}
}
/// <summary>
/// 语言名称
/// </summary>
public string[] Name { private set; get; }
/// <summary>
/// 语言索引
/// </summary>
public int Index
{
set
{
if (value > -1 && value < _file.Length)
{
_index = value;
LoadLanguage();
foreach (Form frm in Application.OpenForms)
{
if (frm is SurForm)
SetLanguage((SurForm)frm);
}
}
}
get
{
return _index;
}
}
/// <summary>
/// 加载语言
/// </summary>
/// <param name="name"></param>
public void Load(string name)
{
int idx = Array.FindIndex(Name, s => s == name);
Index = idx;
}
/// <summary>
/// 对话框
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public string Dialog(string key)
{
if (_index == -1) return "";
if (DialogText.TryGetValue(key, out string value))
return value;
else
return "";
}
/// <summary>
/// 创建窗口的文本
/// </summary>
/// <param name="frm"></param>
public void CreateForm(SurForm frm)
{
if (_index == -1) return;
_doc.Load(_file[_index]);
XmlNode root = _doc.LastChild;
XmlElement ele;
XmlNode node = root.SelectSingleNode(frm.Name);
if (node == null)
{
ele = _doc.CreateElement(frm.Name);
root.AppendChild(ele);
}
else
{
node.RemoveAll();
ele = (XmlElement)node;
}
ele.SetAttribute("Text", frm.Text);
ele.SetAttribute("Font", ConvFont(frm.TitleFont));
GetLang(ele, frm);
_doc.Save(_file[_index]);
}
/// <summary>
/// 设置语言
/// </summary>
/// <param name="frm"></param>
public void SetLanguage(SurForm frm)
{
int langIdx = langForm.FindIndex(s => s.FormLang.Name == frm.Name);
if (langIdx == -1) return;
frm.Text = langForm[langIdx].FormLang.Text;
frm.TitleFont = langForm[langIdx].FormLang.Font;
SetLang(langIdx, frm);
}
private void LoadLanguage()
{
_doc.Load(_file[_index]);
XmlNode root = _doc.LastChild;
langForm.Clear();
DialogText.Clear();
foreach (XmlNode node in root.ChildNodes)
{
if (node.Name == "Dialog")
{
foreach (XmlNode tt in node.ChildNodes)
DialogText.Add(tt.Name, tt.InnerText);
}
else
{
ClsLangForm lang = new ClsLangForm();
lang.FormLang.Name = node.Name;
if (node.Attributes["Text"] != null) lang.FormLang.Text = node.Attributes["Text"].Value;
if (node.Attributes["Font"] != null) lang.FormLang.Font = ConvFont(node.Attributes["Font"].Value);
if (node.Attributes["Tag"] != null) lang.FormLang.Tag = node.Attributes["Tag"].Value;
foreach (XmlNode tt in node.ChildNodes)
{
ClsLangText ll = new ClsLangText();
ll.Name = tt.Name;
if (tt.Attributes["Text"] != null) ll.Text = tt.Attributes["Text"].Value;
if (tt.Attributes["Font"] != null) ll.Font = ConvFont(tt.Attributes["Font"].Value);
if (tt.Attributes["Tag"] != null) ll.Tag = tt.Attributes["Tag"].Value;
lang.ControlLang.Add(ll);
}
langForm.Add(lang);
}
}
}
private void SetLang(int langIndex, Control ctl)
{
foreach (Control cc in ctl.Controls)
{
if (cc.Name == "") continue;
int idx = langForm[langIndex].ControlLang.FindIndex(s => s.Name == cc.Name);
if (idx > -1)
{
cc.Text = langForm[langIndex].ControlLang[idx].Text;
if (cc is SurPanel)
((SurPanel)cc).TitleFont = langForm[langIndex].ControlLang[idx].Font;
else
cc.Font = langForm[langIndex].ControlLang[idx].Font;
cc.Tag = langForm[langIndex].ControlLang[idx].Tag;
}
if (cc.HasChildren)
SetLang(langIndex, cc);
}
}
private void GetLang(XmlElement ele, Control ctl)
{
foreach (Control cc in ctl.Controls)
{
if (cc.Name == "") continue;
XmlElement ele1 = _doc.CreateElement(cc.Name);
ele1.SetAttribute("Text", cc.Text);
ele1.SetAttribute("Font", ConvFont(cc.Font));
ele.AppendChild(ele1);
if (cc.HasChildren)
GetLang(ele, cc);
}
}
/// <summary>
/// 转换字体
/// </summary>
/// <param name="s">格式:字体,字号,粗体,斜体</param>
/// <returns></returns>
private Font ConvFont(string s)
{
string[] t = s.Split(',');
float emSize = Convert.ToSingle(t[1]);
FontStyle style = FontStyle.Regular;
if (t[2] == "B") style |= FontStyle.Bold;
if (t[3] == "I") style |= FontStyle.Italic;
Font font = new Font(t[0], emSize, style);
return font;
}
/// <summary>
/// 转换字体
/// </summary>
/// <param name="f">字体</param>
/// <returns></returns>
private string ConvFont(Font f)
{
string[] s = new string[4];
s[0] = f.Name;
s[1] = f.Size.ToString();
if (f.Bold) s[2] = "B";
if (f.Italic) s[3] = "I";
return string.Join(",", s);
}
private class ClsLangForm
{
public ClsLangText FormLang;
public List<ClsLangText> ControlLang;
public ClsLangForm()
{
FormLang = new ClsLangText();
ControlLang = new List<ClsLangText>();
}
}
private class ClsLangText
{
public string Name = "";
public string Text = "";
public Font Font = null;
public string Tag = "";
}
}
}
\ No newline at end of file
此文件的差异被折叠, 点击展开。
namespace Asa.Face
{
partial class BaseCtl
{
/// <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.SuspendLayout();
//
// BaseCtl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Name = "BaseCtl";
this.Size = new System.Drawing.Size(84, 56);
this.Load += new System.EventHandler(this.BaseCtl_Load);
this.Resize += new System.EventHandler(this.BaseCtl_Resize);
this.ResumeLayout(false);
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Asa.Face
{
public partial class BaseCtl : UserControl
{
private bool _inside = false;
private int _borderW = 2;
public BaseCtl()
{
InitializeComponent();
AutoScaleMode = AutoScaleMode.None;
}
[Browsable(false)]
public new AutoScaleMode AutoScaleMode { set => base.AutoScaleMode = value; get => base.AutoScaleMode; }
/// <summary>
/// 鼠标焦点在控件里面
/// </summary>
[Browsable(false)]
public bool Inside
{
set
{
if (_inside != value)
{
if (Enabled)
{
_inside = value;
Refresh();
}
}
}
get
{
return _inside;
}
}
[Browsable(false)]
public Rectangle BorderRect { set; get; }
[Browsable(false)]
public Pen BorderInsidePen { set; get; }
[Browsable(false)]
public Pen BorderOutsidePen { set; get; }
[Browsable(true), DefaultValue(2)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public int BorderWidth
{
set
{
if (value < 0)
_borderW = 0;
else
_borderW = value;
CalcSize();
Refresh();
}
get
{
return _borderW;
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public override string Text
{
get => base.Text;
set
{
base.Text = value;
CalcSize();
Refresh();
}
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public override Font Font
{
get => base.Font;
set
{
base.Font = value;
CalcSize();
Refresh();
}
}
[Browsable(true), DefaultValue(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public new bool Enabled
{
set
{
base.Enabled = value;
Refresh();
}
get
{
return base.Enabled;
}
}
[Browsable(false)]
public Bitmap ToImage()
{
IntPtr hSrce = API.GetWindowDC(Handle);
IntPtr hDest = API.CreateCompatibleDC(hSrce);
IntPtr hBmp = API.CreateCompatibleBitmap(hSrce, Width, Height);
IntPtr hOldBmp = API.SelectObject(hDest, hBmp);
if (API.BitBlt(hDest, 0, 0, Width, Height, hSrce, 0, 0, CopyPixelOperation.SourceCopy | CopyPixelOperation.CaptureBlt))
{
Bitmap bmp = Image.FromHbitmap(hBmp);
API.SelectObject(hDest, hOldBmp);
API.DeleteObject(hBmp);
API.DeleteDC(hDest);
API.ReleaseDC(Handle, hSrce);
return bmp;
}
return null;
}
/// <summary>
/// 计算大小
/// </summary>
protected virtual void CalcSize() {
BorderRect = new Rectangle(_borderW / 2, _borderW / 2, Width - _borderW, Height - _borderW);
BorderInsidePen = new Pen(Common.BLUE_COLOR, _borderW);
BorderOutsidePen = new Pen(Common.BORDER_COLOR, _borderW);
}
private void BaseCtl_Load(object sender, EventArgs e)
{
AutoScaleMode = AutoScaleMode.None;
CalcSize();
Refresh();
}
private void BaseCtl_Resize(object sender, EventArgs e)
{
CalcSize();
Refresh();
}
protected override void WndProc(ref Message m)
{
//if (DesignMode)
//{
// base.WndProc(ref m);
//}
//else
//{
// if (m.Msg == 0x0014) // 禁掉清除背景消息
// return;
// base.WndProc(ref m);
//}
if (m.Msg == 0x0014) // 禁掉清除背景消息
return;
base.WndProc(ref m);
}
}
}
<?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>
\ No newline at end of file
namespace Asa.Face
{
partial class BaseCtls
{
/// <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.SuspendLayout();
//
// BaseCtls
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BorderRect = new System.Drawing.Rectangle(1, 1, 82, 54);
this.Name = "BaseCtls";
this.Paint += new System.Windows.Forms.PaintEventHandler(this.BaseCtls_Paint);
this.ResumeLayout(false);
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Asa.Face
{
public partial class BaseCtls : BaseCtl
{
public BaseCtls()
{
InitializeComponent();
}
private void BaseCtls_Paint(object sender, PaintEventArgs e)
{
e.Graphics.Clear(Common.BACK_COLOR); //背景
}
}
}
<?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>
\ No newline at end of file
namespace Asa.Face
{
partial class SurButton
{
/// <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.SuspendLayout();
//
// SurButton
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BorderRect = new System.Drawing.Rectangle(1, 1, 78, 38);
this.Name = "SurButton";
this.Paint += new System.Windows.Forms.PaintEventHandler(this.SurButton_Paint);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SurButton_MouseDown);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SurButton_MouseMove);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SurButton_MouseUp);
this.ResumeLayout(false);
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace Asa.Face
{
/// <summary>
/// 按钮控件
/// </summary>
[DefaultProperty("Text")]
[DefaultEvent("Click")]
public partial class SurButton : BaseCtl
{
private bool _down = false;
private Bitmap _img = null;
private Size _imgSize = new Size();
private HorizontalAlignment _textAlign = HorizontalAlignment.Center;
private Color _color = Color.Empty;
private RectangleF _colorPoint = new RectangleF();
private RectangleF _imgRect = new RectangleF();
private RectangleF _textRect = new RectangleF();
private const int SPACE = 6; //图片与文字的间隔
/// <summary>
/// 按钮控件
/// </summary>
public SurButton()
{
InitializeComponent();
}
//==========事件==========
/// <summary>
/// 单击时发生
/// </summary>
[Browsable(true), Category(""), Description("单击时发生")]
public new event MyEvent.Click Click;
//==========属性==========
/// <summary>
/// 控件上显示的图像
/// </summary>
[Browsable(true), Category(""), Description("控件上显示的图像"), DefaultValue(null)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public Bitmap Image
{
set
{
_img = value;
if (_img == null)
{
ImageSize = new Size();
}
else
{
if (_imgSize.Width == 0 || _imgSize.Height == 0)
ImageSize = _img.Size;
else
{
CalcSize();
Refresh();
}
}
}
get
{
return _img;
}
}
/// <summary>
/// 显示的图像的大小
/// </summary>
[Browsable(true), Category(""), Description("显示的图像的大小")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public Size ImageSize
{
set
{
_imgSize = value;
CalcSize();
Refresh();
}
get
{
return _imgSize;
}
}
/// <summary>
/// 显示的文本的对齐方式
/// </summary>
[Browsable(true), Category(""), Description("显示的文本的对齐方式"), DefaultValue(HorizontalAlignment.Center)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public HorizontalAlignment TextAlign
{
set
{
_textAlign = value;
CalcSize();
Refresh();
}
get
{
return _textAlign;
}
}
/// <summary>
/// 控件内部间距
/// </summary>
[Browsable(true), Category(""), Description("控件内部间距")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public new Padding Padding
{
set
{
base.Padding = value;
CalcSize();
Refresh();
}
get => base.Padding;
}
/// <summary>
/// 状态颜色
/// </summary>
[Browsable(true), Category(""), Description("状态颜色")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public Color StateColor
{
set
{
_color = value;
Refresh();
}
get
{
return _color;
}
}
//==========私有==========
/// <summary>
/// 计算位置大小
/// </summary>
protected override void CalcSize()
{
base.CalcSize();
Graphics g = CreateGraphics();
SizeF sf = g.MeasureString(Text, Font);
_imgRect = new RectangleF(0, (Height - _imgSize.Height) / 2f, _imgSize.Width, _imgSize.Height);
_textRect = new RectangleF(0, (Height - sf.Height) / 2f, sf.Width, sf.Height);
_colorPoint = new RectangleF(BorderWidth + 4, BorderWidth + 4, 10, 10);
float x;
switch (_textAlign)
{
case HorizontalAlignment.Left:
x = BorderWidth + Padding.Left;
if (_img != null)
{
_imgRect.X = x;
x += _imgSize.Width + SPACE;
}
_textRect.X = x;
break;
case HorizontalAlignment.Center:
if (_img != null)
{
x = (Width - sf.Width - _imgSize.Width - SPACE) / 2f;
_imgRect.X = x;
x += _imgSize.Width + SPACE;
}
else
{
x = (Width - sf.Width) / 2f;
}
_textRect.X = x;
break;
case HorizontalAlignment.Right:
x = Width - BorderWidth - Padding.Right - sf.Width;
_textRect.X = x;
if (_img != null)
{
x = x - SPACE - _imgSize.Width;
_imgRect.X = x;
}
break;
}
}
private void SurButton_MouseDown(object sender, MouseEventArgs e)
{
if (!Enabled) return;
if (e.Button == MouseButtons.Left)
{
_down = true;
Refresh();
}
}
private void SurButton_MouseMove(object sender, MouseEventArgs e)
{
}
private void SurButton_MouseUp(object sender, MouseEventArgs e)
{
if (!Enabled) return;
if (e.Button == MouseButtons.Left)
{
_down = false;
Refresh();
Click?.Invoke(this);
}
}
private void SurButton_Paint(object sender, PaintEventArgs e)
{
BufferedGraphicsContext current = BufferedGraphicsManager.Current;
BufferedGraphics bg = current.Allocate(e.Graphics, e.ClipRectangle);
Graphics g = bg.Graphics;
g.SmoothingMode = SmoothingMode.HighQuality;
g.CompositingQuality = CompositingQuality.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.Clear(Common.BACK_COLOR); //背景
//控件边框
if (Inside && Enabled)
{
if (_down)
g.FillRectangle(Common.BLUE_BRUSH, BorderRect);
else
g.FillRectangle(Common.OVER_BRUSH, BorderRect);
if (BorderWidth > 0)
g.DrawRectangle(BorderInsidePen, BorderRect);
}
else
{
if (BorderWidth > 0)
g.DrawRectangle(BorderOutsidePen, BorderRect);
}
//图标
if (_img != null)
g.DrawImage(_img, _imgRect, new RectangleF(0, 0, _img.Width, _img.Height), GraphicsUnit.Pixel);
//文字
if (Enabled)
g.DrawString(Text, Font, Common.FORE_BRUSH, _textRect);
else
g.DrawString(Text, Font, Common.BORDER_BRUSH, _textRect);
//状态点
if (_color != Color.Empty && Enabled)
g.FillEllipse(new SolidBrush(_color), _colorPoint);
bg.Render();
bg.Dispose();
}
}
}
<?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>
\ No newline at end of file
namespace Asa.Face
{
partial class SurButtonOKCancel
{
/// <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.SuspendLayout();
//
// SurButtonOKCancel
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BorderRect = new System.Drawing.Rectangle(1, 1, 78, 38);
this.Name = "SurButtonOKCancel";
this.Paint += new System.Windows.Forms.PaintEventHandler(this.SurButton_Paint);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SurButton_MouseDown);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SurButton_MouseMove);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SurButton_MouseUp);
this.ResumeLayout(false);
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace Asa.Face
{
/// <summary>
/// OK/Cancel两个按钮
/// </summary>
[DefaultProperty("ButtonIndex")]
[DefaultEvent("Click")]
public partial class SurButtonOKCancel : BaseCtl
{
private int _down = -1;
private int _over = -1;
private RectangleF[] _textRect = new RectangleF[2];
private Rectangle[] _btnRect = new Rectangle[2];
private const int SPACE = 6;
private static readonly string[] TEXT = new string[] { "OK", "Cancel" };
/// <summary>
/// OK/Cancel两个按钮
/// </summary>
public SurButtonOKCancel()
{
InitializeComponent();
}
//==========事件==========
/// <summary>
/// 单击时发生
/// </summary>
[Browsable(true), Category(""), Description("单击时发生")]
public new event MyEvent.Click Click;
//==========属性==========
/// <summary>
/// 按钮的Index索引
/// </summary>
[Browsable(false), Category(""), Description("按钮的Index索引")]
public int ButtonIndex { set; get; } = -1;
//==========私有==========
/// <summary>
/// 计算位置大小
/// </summary>
protected override void CalcSize()
{
base.CalcSize();
int w = (Width - SPACE) / 2;
_btnRect[0] = new Rectangle(BorderWidth / 2, BorderWidth / 2, w - BorderWidth, Height - BorderWidth);
_btnRect[1] = new Rectangle(w + SPACE, BorderWidth / 2, w - BorderWidth, Height - BorderWidth);
Graphics g = CreateGraphics();
SizeF sf = g.MeasureString(TEXT[0], Font);
_textRect[0] = new RectangleF((w - sf.Width) / 2f, (Height - sf.Height) / 2f, sf.Width, sf.Height);
sf = g.MeasureString(TEXT[1], Font);
_textRect[1] = new RectangleF(w + (w - sf.Width) / 2f + SPACE, (Height - sf.Height) / 2f, sf.Width, sf.Height);
}
private void SurButton_MouseDown(object sender, MouseEventArgs e)
{
if (!Enabled) return;
if (e.Button == MouseButtons.Left)
{
if (_over > -1)
{
_down = _over;
Refresh();
}
}
}
private void SurButton_MouseMove(object sender, MouseEventArgs e)
{
if (!Enabled) return;
int move = -1;
for (int i = 0; i < _btnRect.Length; i++)
{
if (_btnRect[i].Contains(e.Location))
{
move = i;
break;
}
}
if (_over != move)
{
_over = move;
Refresh();
}
}
private void SurButton_MouseUp(object sender, MouseEventArgs e)
{
if (!Enabled) return;
if (e.Button == MouseButtons.Left)
{
if (_over > -1 && _down > -1)
{
ButtonIndex = _over;
_down = -1;
Refresh();
Click?.Invoke(this);
ButtonIndex = -1;
}
}
}
private void SurButton_Paint(object sender, PaintEventArgs e)
{
BufferedGraphicsContext current = BufferedGraphicsManager.Current;
BufferedGraphics bg = current.Allocate(e.Graphics, e.ClipRectangle);
Graphics g = bg.Graphics;
g.SmoothingMode = SmoothingMode.HighQuality;
g.CompositingQuality = CompositingQuality.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.Clear(Common.BACK_COLOR); //背景
if (Enabled)
{
if (!Inside) _over = -1;
for (int i = 0; i < _btnRect.Length; i++)
{
if (i == _down)
{
g.FillRectangle(Common.BLUE_BRUSH, _btnRect[i]);
}
else if (i == _over)
{
g.FillRectangle(Common.OVER_BRUSH, _btnRect[i]);
if (BorderWidth > 0)
g.DrawRectangle(BorderInsidePen, _btnRect[i].X, _btnRect[i].Y, _btnRect[i].Width, _btnRect[i].Height);
}
else
{
g.DrawRectangle(BorderOutsidePen, _btnRect[i].X, _btnRect[i].Y, _btnRect[i].Width, _btnRect[i].Height);
}
g.DrawString(TEXT[i], Font, Common.FORE_BRUSH, _textRect[i]);
}
}
else
{
if (BorderWidth > 0)
{
g.DrawRectangle(BorderOutsidePen, _btnRect[0].X, _btnRect[0].Y, _btnRect[0].Width, _btnRect[0].Height);
g.DrawRectangle(BorderOutsidePen, _btnRect[1].X, _btnRect[1].Y, _btnRect[1].Width, _btnRect[1].Height);
}
g.DrawString(TEXT[0], Font, Common.BORDER_BRUSH, _textRect[0]);
g.DrawString(TEXT[1], Font, Common.BORDER_BRUSH, _textRect[1]);
}
bg.Render();
bg.Dispose();
}
}
}
<?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>
\ No newline at end of file
namespace Asa.Face
{
partial class SurChart
{
/// <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.SuspendLayout();
//
// SurChart
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BorderRect = new System.Drawing.Rectangle(1, 1, 279, 146);
this.Name = "SurChart";
this.Size = new System.Drawing.Size(281, 148);
this.Load += new System.EventHandler(this.SurChart_Load);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.SurChart_Paint);
this.ResumeLayout(false);
}
#endregion
}
}
<?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>
\ No newline at end of file
namespace Asa.Face
{
partial class SurCheck
{
/// <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.SuspendLayout();
//
// SurCheck
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BorderRect = new System.Drawing.Rectangle(1, 1, 78, 38);
this.Name = "SurCheck";
this.Paint += new System.Windows.Forms.PaintEventHandler(this.FlatCheck_Paint);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.FlatCheck_MouseDown);
this.ResumeLayout(false);
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace Asa.Face
{
/// <summary>
/// 复选框控件
/// </summary>
[DefaultProperty("Checked")]
[DefaultEvent("CheckedChanged")]
public partial class SurCheck : BaseCtl
{
private bool _check;
private GraphicsPath _switchPath = new GraphicsPath();
private RectangleF _switchPoint = new RectangleF();
private RectangleF _textRect = new RectangleF();
private string _text = "";
private int _radius = 9;
private int _between = 20;
private static readonly Pen SWITCH_PEN = new Pen(Common.FORE_COLOR, 1);
/// <summary>
/// 复选框控件
/// </summary>
public SurCheck()
{
InitializeComponent();
}
//==========事件==========
/// <summary>
/// Check属性更改时发生
/// </summary>
[Browsable(true), Category(""), Description("Check属性更改时发生")]
public event MyEvent.Changed CheckedChanged;
//==========属性==========
/// <summary>
/// 组件是否处于选中状态
/// </summary>
[Browsable(true), Category(""), Description("组件是否处于选中状态"), DefaultValue(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public bool Checked
{
set
{
_check = value;
CalcSize();
Refresh();
CheckedChanged?.Invoke(this);
}
get
{
return _check;
}
}
/// <summary>
/// 左右半圆的半径
/// </summary>
[Browsable(true), Category(""), Description("左右半圆的半径"), DefaultValue(9)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public int Radius
{
get
{
return _radius;
}
set
{
_radius = value;
CalcSize();
Refresh();
}
}
/// <summary>
/// 左右半圆的圆心距离
/// </summary>
[Browsable(true), Category(""), Description("左右半圆的圆心距离"), DefaultValue(20)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public int CircleSpace
{
set
{
_between = value;
CalcSize();
Refresh();
}
get
{
return _between;
}
}
//==========私有==========
/// <summary>
/// 计算大小
/// </summary>
protected override void CalcSize()
{
base.CalcSize();
int diameter = _radius * 2; //直径
RectangleF rect1 = new RectangleF(6, (Height - diameter) / 2f, diameter, diameter);
RectangleF rect2 = new RectangleF(6 + _between, (Height - diameter) / 2f, diameter, diameter);
SizeF sf = CreateGraphics().MeasureString(Text, Font);
_textRect = new RectangleF(rect2.X + rect2.Width + 6, (Height - sf.Height) / 2f, sf.Width, sf.Height);
_switchPath = new GraphicsPath();
_switchPath.AddArc(rect1, 90, 180);
_switchPath.AddLine(rect1.X + _radius, rect1.Y, rect2.X + _radius, rect2.Y);
_switchPath.AddArc(rect2, -90, 180);
_switchPath.AddLine(rect2.X + _radius, rect2.Y + diameter, rect1.X + _radius, rect1.Y + diameter);
int d = _radius * 2 - 6;
if (_check)
_switchPoint = new RectangleF(rect2.X + _radius - d / 2f, rect2.Y + _radius - d / 2f, d, d);
else
_switchPoint = new RectangleF(rect1.X + _radius - d / 2f, rect1.Y + _radius - d / 2f, d, d);
_text = Text;
string[] arr = Text.Split(',');
if (arr.Length == 2)
_text = _check ? arr[1] : arr[0];
}
private void FlatCheck_Paint(object sender, PaintEventArgs e)
{
BufferedGraphicsContext current = BufferedGraphicsManager.Current;
BufferedGraphics bg = current.Allocate(e.Graphics, e.ClipRectangle);
Graphics g = bg.Graphics;
g.SmoothingMode = SmoothingMode.HighQuality;
g.CompositingQuality = CompositingQuality.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.Clear(Common.BACK_COLOR); //背景
//边框
if (Inside && Enabled)
{
if (BorderWidth > 0)
g.DrawRectangle(BorderInsidePen, BorderRect);
}
else
{
if (BorderWidth > 0)
g.DrawRectangle(BorderOutsidePen, BorderRect);
}
//开关
if (_check && Enabled)
g.FillPath(Common.BLUE_BRUSH, _switchPath);
else
g.DrawPath(SWITCH_PEN, _switchPath);
//开关点
if (Enabled)
g.FillEllipse(Common.FORE_BRUSH, _switchPoint);
//文本
if (Enabled)
g.DrawString(_text, Font, Common.FORE_BRUSH, _textRect);
else
g.DrawString(_text, Font, Common.BORDER_BRUSH, _textRect);
bg.Render();
bg.Dispose();
}
private void FlatCheck_MouseDown(object sender, MouseEventArgs e)
{
if (!Enabled) return;
if (e.Button == MouseButtons.Left)
Checked = !Checked;
}
}
}
<?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>
\ No newline at end of file
namespace Asa.Face
{
partial class SurChoose
{
/// <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.SuspendLayout();
//
// SurChoose
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BorderRect = new System.Drawing.Rectangle(1, 1, 78, 38);
this.Name = "SurChoose";
this.Load += new System.EventHandler(this.SurChoose_Load);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.SurChoose_Paint);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SurChoose_MouseDown);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SurChoose_MouseMove);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SurChoose_MouseUp);
this.ResumeLayout(false);
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace Asa.Face
{
/// <summary>
/// 选择控件
/// </summary>
[DefaultProperty("Text")]
[DefaultEvent("SelectedIndexChanged")]
public partial class SurChoose : BaseCtl
{
private RectangleF[] _btnRect;
private string[] _btnText;
private RectangleF[] _btnTextRect;
private int _indexOver = -1;
private int _index = -1;
private const int SPACE = 3;
/// <summary>
/// 选择控件
/// </summary>
public SurChoose()
{
InitializeComponent();
}
//==========事件==========
/// <summary>
/// SelectedIndex属性更改时发生
/// </summary>
[Browsable(true), Category(""), Description("SelectedIndex属性更改时发生")]
public event MyEvent.Changed SelectedIndexChanged;
//==========属性==========
/// <summary>
/// 当前选定项从零开始的索引
/// </summary>
[Browsable(false), Category(""), Description("当前选定项从零开始的索引")]
public int SelectedIndex
{
set
{
_index = value;
Refresh();
if (Enabled)
SelectedIndexChanged?.Invoke(this);
}
get => _index;
}
/// <summary>
/// 当前选定项的文本
/// </summary>
[Browsable(false), Category(""), Description("当前选定项的文本")]
public string SelectedText
{
set
{
if (_btnText != null)
{
int idx = Array.FindIndex(_btnText, s => s == value);
if (idx > -1) SelectedIndex = idx;
}
}
get
{
if (_btnText == null)
return "";
else if (_index < 0)
return "";
else
return _btnText[_index];
}
}
//==========私有==========
/// <summary>
/// 计算位置大小
/// </summary>
protected override void CalcSize()
{
base.CalcSize();
_btnText = Text.Split(',');
int count = _btnText.Length;
_btnRect = new RectangleF[count];
_btnTextRect = new RectangleF[count];
float w = Width - BorderWidth - BorderWidth;
float h = Height - BorderWidth - BorderWidth;
float ww = (w - SPACE * (count + 1)) / count;
float hh = h - SPACE - SPACE;
Graphics g = CreateGraphics();
SizeF sf;
for (int i = 0; i < count; i++)
{
_btnRect[i] = new RectangleF(BorderWidth + SPACE * (i + 1) + ww * i, BorderWidth + SPACE, ww, hh);
sf = g.MeasureString(_btnText[i], Font);
_btnTextRect[i] = new RectangleF(_btnRect[i].X + (_btnRect[i].Width - sf.Width) / 2, _btnRect[i].Y + (_btnRect[i].Height - sf.Height) / 2, sf.Width, sf.Height);
}
}
private void SurChoose_Paint(object sender, PaintEventArgs e)
{
BufferedGraphicsContext current = BufferedGraphicsManager.Current;
BufferedGraphics bg = current.Allocate(e.Graphics, e.ClipRectangle);
Graphics g = bg.Graphics;
g.SmoothingMode = SmoothingMode.HighQuality;
g.CompositingQuality = CompositingQuality.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.Clear(Common.BACK_COLOR); //背景
//控件边框
if (Inside && Enabled)
{
if (BorderWidth > 0)
g.DrawRectangle(BorderInsidePen, BorderRect);
}
else
{
_indexOver = -1; //避免移动太快没有执行MouseMove
if (BorderWidth > 0)
g.DrawRectangle(BorderOutsidePen, BorderRect);
}
for (int i = 0; i < _btnRect.Length; i++)
{
if (Enabled)
{
if (i == _index)
g.FillRectangle(Common.BLUE_BRUSH, _btnRect[i]);
else if (i == _indexOver)
g.FillRectangle(Common.OVER_BRUSH, _btnRect[i]);
g.DrawString(_btnText[i], Font, Common.FORE_BRUSH, _btnTextRect[i]);
}
else
{
g.DrawString(_btnText[i], Font, Common.BORDER_BRUSH, _btnTextRect[i]);
}
}
bg.Render();
bg.Dispose();
}
private void SurChoose_Load(object sender, EventArgs e)
{
_index = -1;
}
private void SurChoose_MouseMove(object sender, MouseEventArgs e)
{
if (!Enabled) return;
int move = -1;
for (int i = 0; i < _btnRect.Length; i++)
{
if (_btnRect[i].Contains(e.Location))
{
move = i;
break;
}
}
if (_indexOver != move)
{
_indexOver = move;
Refresh();
}
}
private void SurChoose_MouseDown(object sender, MouseEventArgs e)
{
if (!Enabled) return;
if (e.Button == MouseButtons.Left)
{
if (_indexOver > -1)
{
_index = _indexOver;
Refresh();
}
}
}
private void SurChoose_MouseUp(object sender, MouseEventArgs e)
{
if (!Enabled) return;
if (e.Button == MouseButtons.Left)
{
if (_indexOver > -1 && _index > -1)
{
SelectedIndexChanged?.Invoke(this);
}
}
}
}
}
<?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>
\ No newline at end of file
namespace Asa.Face
{
partial class SurCombo
{
/// <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.SuspendLayout();
//
// SurCombo
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BorderRect = new System.Drawing.Rectangle(1, 1, 78, 38);
this.Name = "SurCombo";
this.Paint += new System.Windows.Forms.PaintEventHandler(this.SurCombo_Paint);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SurCombo_MouseDown);
this.MouseLeave += new System.EventHandler(this.SurCombo_MouseLeave);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SurCombo_MouseMove);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SurCombo_MouseUp);
this.ResumeLayout(false);
}
#endregion
}
}
<?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>
\ No newline at end of file
namespace Asa.Face
{
partial class SurDataGrid
{
/// <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.SuspendLayout();
//
// SurDataGrid
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BorderRect = new System.Drawing.Rectangle(1, 1, 132, 91);
this.Name = "SurDataGrid";
this.Size = new System.Drawing.Size(134, 93);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.SurDataGrid_Paint);
this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.SurDataGrid_MouseClick);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SurDataGrid_MouseDown);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SurDataGrid_MouseMove);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SurDataGrid_MouseUp);
this.ResumeLayout(false);
}
#endregion
}
}
<?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>
\ No newline at end of file
namespace Asa.Face
{
partial class SurHScrollBar
{
/// <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.SuspendLayout();
//
// SurHScrollBar
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BorderRect = new System.Drawing.Rectangle(1, 1, 78, 18);
this.Name = "SurHScrollBar";
this.Size = new System.Drawing.Size(80, 20);
this.Load += new System.EventHandler(this.SurScrollBar_Load);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.ScrollBar_Paint);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ScrollBar_MouseDown);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ScrollBar_MouseMove);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ScrollBar_MouseUp);
this.ResumeLayout(false);
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace Asa.Face
{
/// <summary>
/// 水平滚动条
/// </summary>
[DefaultProperty("Value")]
[DefaultEvent("ValueChanged")]
public partial class SurHScrollBar : BaseCtl
{
private Rectangle _button1 = new Rectangle();
private Rectangle _button2 = new Rectangle();
private RectangleF _slider = new RectangleF();
private GraphicsPath _btnShape1 = new GraphicsPath();
private GraphicsPath _btnShape2 = new GraphicsPath();
private int _over = -1;
private int _down = -1;
private int _oldX = -1;
private int _max = 100;
private int _min = 0;
private int _value = 0;
private float _step = SLIDER_STEP;
private const int BTN_SIZE = 25;
private const int SLIDER_MIN = 15;
private const int SLIDER_STEP = 2;
private static readonly Color BACK = Color.FromArgb(40, 40, 40);
private static readonly Brush BTN_BRUSH = new SolidBrush(Color.FromArgb(60, 60, 60));
private static readonly Brush SLIDER_BRUSH = new SolidBrush(Color.FromArgb(60, 60, 60));
private static readonly Brush SLIDER_OVER = new SolidBrush(Color.FromArgb(70, 70, 70));
/// <summary>
/// 水平滚动条
/// </summary>
public SurHScrollBar()
{
InitializeComponent();
BackColor = BACK;
}
//==========事件==========
/// <summary>
/// 在控件的值更改时发生
/// </summary>
[Browsable(true), Category(""), Description("在控件的值更改时发生")]
public event MyEvent.Changed ValueChanged;
//==========属性==========
/// <summary>
/// 可滚动范围的上限值
/// </summary>
[Browsable(true), Category(""), Description("可滚动范围的上限值"), DefaultValue(100)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public int Maximum
{
set
{
if (value < _min)
_max = _min + 1;
else
_max = value;
if (_value > _max)
_value = _max;
CalcSize();
Refresh();
}
get => _max;
}
/// <summary>
/// 可滚动范围的下限值
/// </summary>
[Browsable(true), Category(""), Description("可滚动范围的下限值"), DefaultValue(0)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public int Minimum
{
set
{
if (value >= _max)
_min = _max - 1;
else if (value < 0)
_min = 0;
else
_min = value;
if (_value < _min)
_value = _min;
CalcSize();
Refresh();
}
get => _min;
}
/// <summary>
/// 滚动框位置表示的值
/// </summary>
[Browsable(true), Category(""), Description("滚动框位置表示的值"), DefaultValue(0)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public int Value
{
set
{
if (value >= _min && value <= _max)
{
_value = value;
CalcSize();
Refresh();
ValueChanged?.Invoke(this);
}
}
get => _value;
}
//==========私有==========
/// <summary>
/// 计算位置大小
/// </summary>
protected override void CalcSize()
{
base.CalcSize();
_button1 = new Rectangle(0, 0, BTN_SIZE, Height);
_button2 = new Rectangle(Width - BTN_SIZE, 0, BTN_SIZE, Height);
_btnShape1 = Shape.ControlTriangle(_button1, 6, Direction.Left);
_btnShape2 = Shape.ControlTriangle(_button2, 6, Direction.Right);
int w = Width - BTN_SIZE - BTN_SIZE - _max * SLIDER_STEP;
if (w < SLIDER_MIN)
{
w = SLIDER_MIN;
_step = (Width - BTN_SIZE - BTN_SIZE - w) / (float)_max;
}
else
{
_step = SLIDER_STEP;
}
_slider = new RectangleF(BTN_SIZE + _value * _step, 0, w, Height);
}
private void ScrollBar_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (_over > -1)
{
_oldX = e.Y;
_down = _over;
Refresh();
}
}
}
private void ScrollBar_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (_down == 0)
{
if (_value > _min)
{
Value--;
ValueChanged?.Invoke(this);
}
}
else if (_down == 2)
{
if (_value < _max)
{
Value++;
ValueChanged?.Invoke(this);
}
}
_down = -1;
Refresh();
}
}
private void ScrollBar_MouseMove(object sender, MouseEventArgs e)
{
int n = -1;
if (e.Button == MouseButtons.Left)
{
if (_down != 1) return;
n = Convert.ToInt32((e.X - _oldX) / _step);
_oldX += Convert.ToInt32(n * _step);
Value += n;
ValueChanged?.Invoke(this);
}
else
{
if (_button1.Contains(e.Location))
n = 0;
else if (_slider.Contains(e.Location))
n = 1;
else if (_button2.Contains(e.Location))
n = 2;
if (_over != n)
{
_over = n;
Refresh();
}
}
}
private void ScrollBar_Paint(object sender, PaintEventArgs e)
{
BufferedGraphicsContext current = BufferedGraphicsManager.Current;
BufferedGraphics bg = current.Allocate(e.Graphics, e.ClipRectangle);
Graphics g = bg.Graphics;
g.SmoothingMode = SmoothingMode.HighQuality;
g.CompositingQuality = CompositingQuality.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.Clear(BACK); //背景
if (!Inside)
{
_over = -1;
_down = -1;
}
if (_down == 0)
g.FillRectangle(Common.BLUE_BRUSH, _button1);
else if (_over == 0)
g.FillRectangle(BTN_BRUSH, _button1);
if (_down == 1)
g.FillRectangle(Common.BLUE_BRUSH, _slider);
else if (_over == 1)
g.FillRectangle(SLIDER_OVER, _slider);
else
g.FillRectangle(SLIDER_BRUSH, _slider);
if (_down == 2)
g.FillRectangle(Common.BLUE_BRUSH, _button2);
else if (_over == 2)
g.FillRectangle(BTN_BRUSH, _button2);
g.FillPath(Common.FORE_BRUSH, _btnShape1);
g.FillPath(Common.FORE_BRUSH, _btnShape2);
bg.Render();
bg.Dispose();
}
private void SurScrollBar_Load(object sender, EventArgs e)
{
BackColor = BACK;
}
}
}
<?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>
\ No newline at end of file
namespace Asa.Face
{
partial class SurImageShow
{
/// <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.SuspendLayout();
//
// SurImageShow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BorderRect = new System.Drawing.Rectangle(1, 1, 113, 111);
this.Name = "SurImageShow";
this.Size = new System.Drawing.Size(115, 113);
this.Load += new System.EventHandler(this.SurImageShow_Load);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.SurImageShow_Paint);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SurImageShow_MouseDown);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SurImageShow_MouseMove);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SurImageShow_MouseUp);
this.ResumeLayout(false);
}
#endregion
}
}
<?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>
\ No newline at end of file
namespace Asa.Face
{
partial class SurLabel
{
/// <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.SuspendLayout();
//
// SurLabel
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BorderRect = new System.Drawing.Rectangle(1, 1, 78, 38);
this.Name = "SurLabel";
this.Paint += new System.Windows.Forms.PaintEventHandler(this.SurLabel_Paint);
this.ResumeLayout(false);
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace Asa.Face
{
/// <summary>
/// 标签控件
/// </summary>
[DefaultProperty("Text")]
[DefaultEvent("Click")]
public partial class SurLabel : BaseCtl
{
private bool _foreCus = false;
private RectangleF _textRect = new RectangleF();
private HorizontalAlignment _textAlign = HorizontalAlignment.Left;
/// <summary>
/// 标签控件
/// </summary>
public SurLabel()
{
InitializeComponent();
}
//==========属性==========
/// <summary>
/// 显示的文本的对齐方式
/// </summary>
[Browsable(true), Category(""), Description("显示的文本的对齐方式"), DefaultValue(HorizontalAlignment.Left)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public HorizontalAlignment TextAlign
{
set
{
_textAlign = value;
CalcSize();
Refresh();
}
get
{
return _textAlign;
}
}
/// <summary>
/// 前景色是否自定义,通过ForeColor指定
/// </summary>
[Browsable(true), Category(""), Description("前景色是否自定义,通过ForeColor指定"), DefaultValue(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public bool ForeColorCustom
{
set
{
_foreCus = value;
Refresh();
}
get
{
return _foreCus;
}
}
//==========私有==========
/// <summary>
/// 计算位置大小
/// </summary>
protected override void CalcSize()
{
base.CalcSize();
SizeF sf = CreateGraphics().MeasureString(Text, Font, Width);
switch (TextAlign)
{
case HorizontalAlignment.Left:
_textRect = new RectangleF(BorderWidth, (Height - sf.Height) / 2f, sf.Width, sf.Height);
break;
case HorizontalAlignment.Center:
_textRect = new RectangleF((Width - sf.Width) / 2f, (Height - sf.Height) / 2f, sf.Width, sf.Height);
break;
case HorizontalAlignment.Right:
_textRect = new RectangleF(Width - BorderWidth - sf.Width, (Height - sf.Height) / 2f, sf.Width, sf.Height);
break;
}
}
private void SurLabel_Paint(object sender, PaintEventArgs e)
{
BufferedGraphicsContext current = BufferedGraphicsManager.Current;
BufferedGraphics bg = current.Allocate(e.Graphics, e.ClipRectangle);
Graphics g = bg.Graphics;
g.SmoothingMode = SmoothingMode.HighQuality;
g.CompositingQuality = CompositingQuality.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.Clear(Common.BACK_COLOR); //背景
if (Inside && Enabled)
{
if (BorderWidth > 0)
g.DrawRectangle(BorderInsidePen, BorderRect);
}
else
{
if (BorderWidth > 0)
g.DrawRectangle(BorderOutsidePen, BorderRect);
}
if (Enabled)
g.DrawString(Text, Font, _foreCus ? new SolidBrush(ForeColor) : Common.FORE_BRUSH, _textRect);
else
g.DrawString(Text, Font, Common.BORDER_BRUSH, _textRect);
bg.Render();
bg.Dispose();
}
}
}
<?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>
\ No newline at end of file
namespace Asa.Face
{
partial class SurList
{
/// <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.SuspendLayout();
//
// SurList
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BorderRect = new System.Drawing.Rectangle(1, 1, 78, 38);
this.Name = "SurList";
this.Paint += new System.Windows.Forms.PaintEventHandler(this.SurList_Paint);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SurList_MouseDown);
this.MouseLeave += new System.EventHandler(this.SurList_MouseLeave);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SurList_MouseMove);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SurList_MouseUp);
this.ResumeLayout(false);
}
#endregion
}
}
此文件的差异被折叠, 点击展开。
<?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>
\ No newline at end of file
namespace Asa.Face
{
partial class SurLoading
{
/// <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.SuspendLayout();
//
// SurLoading
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BorderRect = new System.Drawing.Rectangle(1, 1, 78, 62);
this.Name = "SurLoading";
this.Size = new System.Drawing.Size(80, 64);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.FlatLoadingRing_Paint);
this.ResumeLayout(false);
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace Asa.Face
{
/// <summary>
/// 加载时的环形动画
/// </summary>
public partial class SurLoading : BaseCtl
{
private int _index = -1;
private PointF _center; //大圆中心
private int _circleRadius = 30; //大圆半径
private int _ringDiam = 10; //小圆直径
private int _count = 12; //小圆个数
private RectangleF[] _ringRect; //小圆大小
private System.Threading.Thread tRing;
/// <summary>
/// 加载时的环形动画
/// </summary>
public SurLoading()
{
InitializeComponent();
}
//==========属性==========
/// <summary>
/// 是否在转动
/// </summary>
[Browsable(false)]
public bool IsRun { get; set; }
/// <summary>
/// 转动的速度
/// </summary>
[Browsable(true), Category(""), Description("转动的速度"), DefaultValue(200)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public int Speed { set; get; } = 200;
/// <summary>
/// 小圈圈的个数,3-100个
/// </summary>
[Browsable(true), Category(""), Description("小圈圈的个数,3-100个"), DefaultValue(12)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public int RingCount
{
set
{
_count = value;
if (_count < 3)
_count = 3;
else if (_count > 100)
_count = 100;
CalcSize();
Refresh();
}
get
{
return _count;
}
}
/// <summary>
/// 小圈圈的半径
/// </summary>
[Browsable(true), Category(""), Description("小圈圈的半径"), DefaultValue(10)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public int RingDiameter
{
set
{
_ringDiam = value;
if (_ringDiam < 2)
_ringDiam = 2;
CalcSize();
Refresh();
}
get
{
return _ringDiam;
}
}
/// <summary>
/// 半径
/// </summary>
[Browsable(true), Category(""), Description("大圆形的半径"), DefaultValue(30)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public int CircleRadius
{
set
{
_circleRadius = value;
CalcSize();
Refresh();
}
get
{
return _circleRadius;
}
}
/// <summary>
/// 开始转动
/// </summary>
[Browsable(false)]
public void Start()
{
_index = 0;
tRing = new System.Threading.Thread(new System.Threading.ThreadStart(Process));
tRing.Start();
IsRun = true;
}
/// <summary>
/// 停止转动
/// </summary>
[Browsable(false)]
public void Stop()
{
IsRun = false;
_index = -1;
if (tRing != null)
{
tRing.Abort();
tRing = null;
}
Refresh();
}
//==========私有==========
/// <summary>
/// 计算大小
/// </summary>
protected override void CalcSize()
{
base.CalcSize();
_center = new PointF(Width / 2f, Height / 2f);
//_radius = Math.Min(_center.X, _center.Y) / 2f;
_ringRect = new RectangleF[_count];
float angle = 360f / _count;
for (int i = 0; i < _ringRect.Length; i++)
{
double radian = (i * angle) * Math.PI / 180;
float x = Convert.ToSingle(Math.Cos(radian) * _circleRadius);
float y = Convert.ToSingle(Math.Sin(radian) * _circleRadius);
PointF pt = new PointF(_center.X + x, _center.Y + y);
_ringRect[i] = new RectangleF(pt.X - _ringDiam / 2f, pt.Y - _ringDiam / 2f, _ringDiam, _ringDiam);
}
}
private void FlatLoadingRing_Paint(object sender, PaintEventArgs e)
{
BufferedGraphicsContext current = BufferedGraphicsManager.Current;
BufferedGraphics bg = current.Allocate(e.Graphics, e.ClipRectangle);
Graphics g = bg.Graphics;
g.SmoothingMode = SmoothingMode.HighQuality;
g.CompositingQuality = CompositingQuality.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.Clear(Common.BACK_COLOR); //背景
if (Inside)
{
if (BorderWidth > 0)
g.DrawRectangle(BorderInsidePen, BorderRect);
}
else
{
if (BorderWidth > 0)
g.DrawRectangle(BorderOutsidePen, BorderRect);
}
for (int i = 0; i < _ringRect.Length; i++)
{
if (i == _index)
g.FillEllipse(Common.BLUE_BRUSH, _ringRect[i]);
else
g.DrawEllipse(Common.FORE_PEN, _ringRect[i]);
}
bg.Render();
bg.Dispose();
}
private void Process()
{
while (true)
{
Invoke(new Action(() => { Refresh(); }));
_index++;
if (_index == _ringRect.Length) _index = 0;
System.Threading.Thread.Sleep(Speed);
}
}
}
}
<?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>
\ No newline at end of file
namespace Asa.Face
{
partial class SurMultiButton
{
/// <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.SuspendLayout();
//
// SurMultiButton
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BorderRect = new System.Drawing.Rectangle(1, 1, 78, 38);
this.Name = "SurMultiButton";
this.Paint += new System.Windows.Forms.PaintEventHandler(this.SurChoose_Paint);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SurChoose_MouseDown);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SurChoose_MouseMove);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SurChoose_MouseUp);
this.ResumeLayout(false);
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace Asa.Face
{
/// <summary>
/// 多个按钮控件
/// </summary>
[DefaultProperty("Text")]
[DefaultEvent("Click")]
public partial class SurMultiButton : BaseCtl
{
private RectangleF[] _btnRect;
private string[] _btnText;
private RectangleF[] _btnTextRect;
private int _over = -1;
private int _down = -1;
private const int SPACE = 3;
/// <summary>
/// 多个按钮控件
/// </summary>
public SurMultiButton()
{
InitializeComponent();
}
//==========事件==========
/// <summary>
/// 单击时发生
/// </summary>
[Browsable(true), Category(""), Description("单击时发生")]
public new event MyEvent.Click Click;
//==========属性==========
/// <summary>
/// 选中的按钮从零开始的索引
/// </summary>
[Browsable(false), Category(""), Description("选中的按钮从零开始的索引")]
public int Index { get; private set; }
//==========私有==========
/// <summary>
/// 计算位置大小
/// </summary>
protected override void CalcSize()
{
base.CalcSize();
_btnText = Text.Split(',');
int count = _btnText.Length;
_btnRect = new RectangleF[count];
_btnTextRect = new RectangleF[count];
float w = Width - BorderWidth - BorderWidth;
float h = Height - BorderWidth - BorderWidth;
float ww = (w - SPACE * (count + 1)) / count;
float hh = h - SPACE - SPACE;
Graphics g = CreateGraphics();
SizeF sf;
for (int i = 0; i < count; i++)
{
_btnRect[i] = new RectangleF(BorderWidth + SPACE * (i + 1) + ww * i, BorderWidth + SPACE, ww, hh);
sf = g.MeasureString(_btnText[i], Font);
_btnTextRect[i] = new RectangleF(_btnRect[i].X + (_btnRect[i].Width - sf.Width) / 2, _btnRect[i].Y + (_btnRect[i].Height - sf.Height) / 2, sf.Width, sf.Height);
}
}
private void SurChoose_Paint(object sender, PaintEventArgs e)
{
BufferedGraphicsContext current = BufferedGraphicsManager.Current;
BufferedGraphics bg = current.Allocate(e.Graphics, e.ClipRectangle);
Graphics g = bg.Graphics;
g.SmoothingMode = SmoothingMode.HighQuality;
g.CompositingQuality = CompositingQuality.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.Clear(Common.BACK_COLOR); //背景
//控件边框
if (Inside && Enabled)
{
if (BorderWidth > 0)
g.DrawRectangle(BorderInsidePen, BorderRect);
}
else
{
_over = -1; //避免移动太快没有执行MouseMove
if (BorderWidth > 0)
g.DrawRectangle(BorderOutsidePen, BorderRect);
}
for (int i = 0; i < _btnRect.Length; i++)
{
if (Enabled)
{
if (i == _down)
g.FillRectangle(Common.BLUE_BRUSH, _btnRect[i]);
else if (i == _over)
g.FillRectangle(Common.OVER_BRUSH, _btnRect[i]);
g.DrawString(_btnText[i], Font, Common.FORE_BRUSH, _btnTextRect[i]);
}
else
{
g.DrawString(_btnText[i], Font, Common.BORDER_BRUSH, _btnTextRect[i]);
}
}
bg.Render();
bg.Dispose();
}
private void SurChoose_MouseMove(object sender, MouseEventArgs e)
{
if (!Enabled) return;
int move = -1;
for (int i = 0; i < _btnRect.Length; i++)
{
if (_btnRect[i].Contains(e.Location))
{
move = i;
break;
}
}
if (_over != move)
{
_over = move;
Refresh();
}
}
private void SurChoose_MouseDown(object sender, MouseEventArgs e)
{
if (!Enabled) return;
if (e.Button == MouseButtons.Left)
{
if (_over > -1)
{
Index = _over;
_down = _over;
Refresh();
}
}
}
private void SurChoose_MouseUp(object sender, MouseEventArgs e)
{
if (!Enabled) return;
if (e.Button == MouseButtons.Left)
{
if (_over > -1 && _down > -1)
{
_down = -1;
Refresh();
Click?.Invoke(this);
}
}
}
}
}
<?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>
\ No newline at end of file
namespace Asa.Face
{
partial class SurNumeric
{
/// <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.SuspendLayout();
//
// SurNumeric
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BorderRect = new System.Drawing.Rectangle(1, 1, 78, 38);
this.Name = "SurNumeric";
this.Load += new System.EventHandler(this.SurNumeric_Load);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.SurNumeric_Paint);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SurNumeric_MouseDown);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SurNumeric_MouseMove);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SurNumeric_MouseUp);
this.ResumeLayout(false);
}
#endregion
}
}
<?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>
\ No newline at end of file
namespace Asa.Face
{
partial class SurRadio
{
/// <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.SuspendLayout();
//
// SurRadio
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BorderRect = new System.Drawing.Rectangle(1, 1, 78, 38);
this.Name = "SurRadio";
this.Paint += new System.Windows.Forms.PaintEventHandler(this.SurRadio_Paint);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SurRadio_MouseDown);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SurRadio_MouseUp);
this.ResumeLayout(false);
}
#endregion
}
}
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件的差异被折叠, 点击展开。
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!