Commit 83a938e3 刘韬

添加项目文件。

1 个父辈 f998f143

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30104.148
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrintLabel", "PrintLabel\PrintLabel.csproj", "{B8F25ECE-DEE6-41D6-8EF0-8AFBF2577C17}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrintLabel_Test", "PrintLabel_Test\PrintLabel_Test.csproj", "{857ACBBF-F326-4AD0-AD6F-B7F7479AFE2C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B8F25ECE-DEE6-41D6-8EF0-8AFBF2577C17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B8F25ECE-DEE6-41D6-8EF0-8AFBF2577C17}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B8F25ECE-DEE6-41D6-8EF0-8AFBF2577C17}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B8F25ECE-DEE6-41D6-8EF0-8AFBF2577C17}.Release|Any CPU.Build.0 = Release|Any CPU
{857ACBBF-F326-4AD0-AD6F-B7F7479AFE2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{857ACBBF-F326-4AD0-AD6F-B7F7479AFE2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{857ACBBF-F326-4AD0-AD6F-B7F7479AFE2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{857ACBBF-F326-4AD0-AD6F-B7F7479AFE2C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {98BC07CF-B6E4-4B45-AEE5-2FC4133EB666}
EndGlobalSection
EndGlobal
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace BLL
{
public static class ClassExtend
{
public static string ReplaceIC(this string msgs, string org, string dst)
{
if (string.IsNullOrEmpty(dst))
dst = "";
return Regex.Replace(msgs, org, dst, RegexOptions.IgnoreCase | RegexOptions.Multiline);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PrintLabel
{
internal static class Common
{
internal static List<Model.ClsLabel> Label;
internal static BLL.LabelPrint LabelPrint;
/// <summary>
/// 像素毫米转换的倍数
/// </summary>
internal const float MULTIPLE = 100f;
/// <summary>
/// 添加标签时初始的大小,mm
/// </summary>
internal const string LABEL_SIZE = "50,70";
/// <summary>
/// 毫米转像素
/// </summary>
/// <param name="mm"></param>
/// <returns></returns>
internal static float MMToPx(float mm)
{
return mm / 25.4f * MULTIPLE;
}
/// <summary>
/// 像素转毫米
/// </summary>
/// <param name="px"></param>
/// <returns></returns>
internal static float PxToMM(float px)
{
return px / MULTIPLE * 25.4f;
}
}
}

namespace Asa
{
partial class FormTextBox
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.btn_cancel = new System.Windows.Forms.Button();
this.btn_ok = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(92, 57);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(321, 21);
this.textBox1.TabIndex = 0;
//
// btn_cancel
//
this.btn_cancel.Location = new System.Drawing.Point(29, 136);
this.btn_cancel.Name = "btn_cancel";
this.btn_cancel.Size = new System.Drawing.Size(75, 23);
this.btn_cancel.TabIndex = 1;
this.btn_cancel.Text = "Cancel";
this.btn_cancel.UseVisualStyleBackColor = true;
this.btn_cancel.Click += new System.EventHandler(this.btn_cancel_Click);
//
// btn_ok
//
this.btn_ok.Location = new System.Drawing.Point(417, 136);
this.btn_ok.Name = "btn_ok";
this.btn_ok.Size = new System.Drawing.Size(75, 23);
this.btn_ok.TabIndex = 2;
this.btn_ok.Text = "OK";
this.btn_ok.UseVisualStyleBackColor = true;
this.btn_ok.Click += new System.EventHandler(this.btn_ok_Click);
//
// FormTextBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(525, 178);
this.ControlBox = false;
this.Controls.Add(this.btn_ok);
this.Controls.Add(this.btn_cancel);
this.Controls.Add(this.textBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FormTextBox";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "FormTextBox";
this.Load += new System.EventHandler(this.FormTextBox_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button btn_cancel;
private System.Windows.Forms.Button btn_ok;
}
}
\ No newline at end of file \ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Asa
{
public partial class FormTextBox : Form
{
public string InputText;
public FormTextBox()
{
InitializeComponent();
}
private void btn_cancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
this.Close();
}
private void btn_ok_Click(object sender, EventArgs e)
{
InputText = textBox1.Text;
DialogResult = DialogResult.OK;
this.Close();
}
private void FormTextBox_Load(object sender, EventArgs e)
{
textBox1.Text = InputText;
}
public static bool ShowInput(string title,ref string input) {
FormTextBox formTextBox = new FormTextBox();
formTextBox.TopMost = true;
formTextBox.Text = title;
formTextBox.InputText = input;
if (formTextBox.ShowDialog() == DialogResult.OK)
{
input = formTextBox.InputText;
return true;
}
else {
return false;
}
}
}
}
<?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 \ No newline at end of file
using Asa;
using Microsoft.VisualBasic;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PrintLabel
{
public partial class FrmLabel : Form
{
private bool change = false;
private bool isLabel = false;
public string desc = "";
public FrmLabel()
{
InitializeComponent();
}
private void LabelPrint_FieldSelected(PointF location, SizeF size, Model.LabelFieldType type)
{
change = true;
NumX.Enabled = true;
NumY.Enabled = true;
NumW.Value = Convert.ToDecimal(size.Width < 0.01 ? 0.01 : size.Width);
NumH.Value = Convert.ToDecimal(size.Height < 0.01 ? 0.01 : size.Height);
NumX.Value = Convert.ToDecimal(location.X);
NumY.Value = Convert.ToDecimal(location.Y);
CboFieldType.Enabled = true;
CboFieldType.Text = type.ToString();
change = false;
isLabel = false;
}
private void LabelPrint_FieldFormat(string s)
{
change = true;
TxtFormatText.Text = s;
change = false;
}
private void LabelPrint_LabelSelected(SizeF size)
{
change = true;
NumW.Value = Convert.ToDecimal(size.Width);
NumH.Value = Convert.ToDecimal(size.Height);
NumX.Value = 0;
NumY.Value = 0;
NumX.Enabled = false;
NumY.Enabled = false;
TxtFormatText.Text = "";
CboFieldType.SelectedIndex = -1;
CboFieldType.Enabled = false;
change = false;
isLabel = true;
}
private void FrmLabel_Load(object sender, EventArgs e)
{
Common.LabelPrint.FieldFormat += LabelPrint_FieldFormat;
Common.LabelPrint.FieldSelected += LabelPrint_FieldSelected;
Common.LabelPrint.LabelSelected += LabelPrint_LabelSelected;
Common.LabelPrint.LabelIndex = -1;
LstLabelName.Items.AddRange(Common.LabelPrint.GetName());
Common.LabelPrint.EditControl(pictureBox1);
CboFieldType.Items.AddRange(Common.LabelPrint.FieldType);
groupBox1.Visible = false;
if (desc != "") {
label_desc.Text = desc;
groupBox1.Visible = true;
}
}
private void FrmLabel_FormClosing(object sender, FormClosingEventArgs e)
{
Common.LabelPrint.FieldFormat -= LabelPrint_FieldFormat;
Common.LabelPrint.FieldSelected -= LabelPrint_FieldSelected;
Common.LabelPrint.LabelSelected -= LabelPrint_LabelSelected;
Common.LabelPrint.EditControl(null);
Common.LabelPrint.LabelIndex = -1;
}
private void LstLabelName_SelectedIndexChanged(object sender, EventArgs e)
{
Common.LabelPrint.LabelIndex = LstLabelName.SelectedIndex;
if (LstLabelName.SelectedIndex == -1) return;
NumW.Value = Convert.ToDecimal(Common.Label[Common.LabelPrint.LabelIndex].Size_mm.Width);
NumH.Value = Convert.ToDecimal(Common.Label[Common.LabelPrint.LabelIndex].Size_mm.Height);
NumX.Value = 0;
NumY.Value = 0;
NumX.Enabled = false;
NumY.Enabled = false;
CboFieldType.Enabled = false;
}
private void BtnLabelNew_Click(object sender, EventArgs e)
{
string name = "";
FormTextBox.ShowInput("New Label Name", ref name);
if (string.IsNullOrWhiteSpace(name)) return;
Common.LabelPrint.LabelNew(name);
LstLabelName.Items.Add(name);
LstLabelName.SelectedIndex = LstLabelName.Items.Count - 1;
}
private void BtnLabelDel_Click(object sender, EventArgs e)
{
if (LstLabelName.SelectedIndex == -1) return;
DialogResult dr = MessageBox.Show("确定要删除 " + LstLabelName.Text + " 吗?", "删除", MessageBoxButtons.YesNo);
if (dr == DialogResult.No) return;
Common.LabelPrint.LabelDel();
LstLabelName.Items.RemoveAt(LstLabelName.SelectedIndex);
if (LstLabelName.Items.Count > 0)
LstLabelName.SelectedIndex = 0;
}
private void BtnRename_Click(object sender, EventArgs e)
{
if (LstLabelName.SelectedIndex == -1) return;
string name = LstLabelName.Text;
FormTextBox.ShowInput("New Label Name", ref name);
if (string.IsNullOrWhiteSpace(name)) return;
Common.LabelPrint.LabelRename(name);
LstLabelName.Items[LstLabelName.SelectedIndex] = name;
}
private void BtnPrintTest_Click(object sender, EventArgs e)
{
if (LstLabelName.SelectedIndex == -1) return;
Common.LabelPrint.PrintTest();
}
private void BtnSave_Click(object sender, EventArgs e)
{
if (LstLabelName.SelectedIndex == -1) return;
Common.LabelPrint.Save();
MessageBox.Show("OK.", "Save", MessageBoxButtons.OK);
}
private void BtnFieldAdd_Click(object sender, EventArgs e)
{
if (LstLabelName.SelectedIndex == -1) return;
Common.LabelPrint.FieldAdd();
}
private void BtnFieldDel_Click(object sender, EventArgs e)
{
if (LstLabelName.SelectedIndex == -1) return;
Common.LabelPrint.FieldDel();
}
private void BtnFieldFont_Click(object sender, EventArgs e)
{
if (LstLabelName.SelectedIndex == -1) return;
Common.LabelPrint.SetFieldFont();
}
private void CboFieldType_SelectedIndexChanged(object sender, EventArgs e)
{
if (change) return;
Common.LabelPrint.SetFieldType(CboFieldType.SelectedIndex);
}
private void NumX_ValueChanged(object sender, EventArgs e)
{
if (change) return;
if (isLabel)
Common.LabelPrint.SetLabelSize(Convert.ToSingle(NumW.Value), Convert.ToSingle(NumH.Value));
else
Common.LabelPrint.SetFieldSize(Convert.ToSingle(NumX.Value), Convert.ToSingle(NumY.Value), Convert.ToSingle(NumW.Value), Convert.ToSingle(NumH.Value));
}
private void NumY_ValueChanged(object sender, EventArgs e)
{
if (change) return;
if (isLabel)
Common.LabelPrint.SetLabelSize(Convert.ToSingle(NumW.Value), Convert.ToSingle(NumH.Value));
else
Common.LabelPrint.SetFieldSize(Convert.ToSingle(NumX.Value), Convert.ToSingle(NumY.Value), Convert.ToSingle(NumW.Value), Convert.ToSingle(NumH.Value));
}
private void NumW_ValueChanged(object sender, EventArgs e)
{
if (change) return;
if (isLabel)
Common.LabelPrint.SetLabelSize(Convert.ToSingle(NumW.Value), Convert.ToSingle(NumH.Value));
else
Common.LabelPrint.SetFieldSize(Convert.ToSingle(NumX.Value), Convert.ToSingle(NumY.Value), Convert.ToSingle(NumW.Value), Convert.ToSingle(NumH.Value));
}
private void NumH_ValueChanged(object sender, EventArgs e)
{
if (change) return;
if (isLabel)
Common.LabelPrint.SetLabelSize(Convert.ToSingle(NumW.Value), Convert.ToSingle(NumH.Value));
else
Common.LabelPrint.SetFieldSize(Convert.ToSingle(NumX.Value), Convert.ToSingle(NumY.Value), Convert.ToSingle(NumW.Value), Convert.ToSingle(NumH.Value));
}
private void TxtFormatText_TextChanged(object sender, EventArgs e)
{
if (change) return;
Common.LabelPrint.SetFieldFormat(TxtFormatText.Text);
}
}
}
<?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 \ No newline at end of file
此文件的差异被折叠, 点击展开。
using PrintLabel;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Management;
using System.Printing;
namespace Asa
{
public class PrintLabel
{
public delegate void PrintStatusEvent(PrinterStatus sta, string msg);
public event PrintStatusEvent PrintStatusChanged;
private System.Threading.Thread tRun;
public PrintLabel(string dir)
{
Common.LabelPrint = new BLL.LabelPrint();
Common.LabelPrint.Load(dir);
}
/// <summary>
/// 加载标签
/// </summary>
/// <param name="labelName"></param>
public void LoadLabel(string labelName)
{
Common.LabelPrint.LabelName = labelName;
}
/// <summary>
/// 编辑标签
/// </summary>
public void EditLabel()
{
FrmLabel frm = new FrmLabel();
frm.ShowDialog();
}
public string[] GetLabelName()
{
return Common.LabelPrint.GetName();
}
public string[] GetPrinterName()
{
List<string> list = new List<string>();
foreach (string ss in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
list.Add(ss);
return list.ToArray();
}
/// <summary>
/// 打印机
/// </summary>
/// <param name="name">打印机名字</param>
/// <param name="landscape">打印方向,横向纵向</param>
public void Printer(string name, bool landscape)
{
Common.LabelPrint.PrinterName = name;
Common.LabelPrint.PrintLandscape = landscape;
}
public bool Rotate180 { set => Common.LabelPrint.Rotate180 = value; get => Common.LabelPrint.Rotate180; }
/// <summary>
/// 打印
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public Bitmap Print(Dictionary<string, string> key)
{
Bitmap bmp = Common.LabelPrint.PrintLast(key, out string[] codeContent);
tRun = new System.Threading.Thread(new System.Threading.ThreadStart(GetStatus));
tRun.Start();
return bmp;
}
public Bitmap PrintPreview(Dictionary<string, string> key)
{
Common.LabelPrint.labelIdx = 1;
Bitmap bmp = Common.LabelPrint.PrintPreview(key, out string[] code);
return bmp;
}
/// <summary>
/// 打印机状态
/// </summary>
public enum PrinterStatus
{
/// <summary>
/// 其他
/// </summary>
Other = 1,
/// <summary>
/// 未知
/// </summary>
Unknown,
/// <summary>
/// 空闲
/// </summary>
Idle,
/// <summary>
/// 正在打印中
/// </summary>
Printing,
/// <summary>
/// 预热
/// </summary>
Preheat,
/// <summary>
/// 停止打印
/// </summary>
Stop,
/// <summary>
/// 打印中
/// </summary>
Print,
/// <summary>
/// 离线
/// </summary>
Offline
}
/// <summary>
/// 获取打印机的当前状态
/// </summary>
public void GetStatus()
{
int n = 0;
int timeout = 0;
string msg = "无";
PrinterStatus sta = PrinterStatus.Other;
string path = "win32_printer.DeviceId='" + Common.LabelPrint.PrinterName + "'";
ManagementObject printer = new ManagementObject(path);
while (true)
{
printer.Get();
int ret = Convert.ToInt32(printer.Properties["PrinterStatus"].Value);
sta = (PrinterStatus)ret;
switch(sta)
{
case PrinterStatus.Other:
msg = "其他";
n = 3;
break;
case PrinterStatus.Unknown:
msg = "未知";
n = 3;
break;
case PrinterStatus.Stop:
msg = "停止";
n = 3;
break;
case PrinterStatus.Offline:
msg = "离线";
n = 3;
break;
case PrinterStatus.Preheat:
msg = "预热";
break;
case PrinterStatus.Print:
msg = "打印中";
n = 1;
break;
case PrinterStatus.Printing:
msg = "打印中";
n = 1;
break;
case PrinterStatus.Idle:
if (n == 1)
{
msg += ",空闲";
n = 2;
}
break;
default:
msg = "default";
n = 3;
break;
}
if (n == 3 || n == 2)
break;
timeout += 500;
System.Threading.Thread.Sleep(500);
if (timeout >= 15000)
break;
}
PrintStatusChanged?.Invoke(sta, msg);
}
private void GetPrintStatus()
{
PrintQueue pq = LocalPrintServer.GetDefaultPrintQueue();
switch (pq.QueueStatus)
{
//正常状态
case PrintQueueStatus.None:
Console.WriteLine("正常运行");
break;
//纸未取走
case PrintQueueStatus.OutputBinFull:
Console.WriteLine("未取走");
break;
//缺纸
case PrintQueueStatus.PaperOut:
Console.WriteLine("缺纸");
break;
//打印
case PrintQueueStatus.Printing:
Console.WriteLine("正在打印");
break;
default:
Console.WriteLine(pq.QueueStatus);
break;
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B8F25ECE-DEE6-41D6-8EF0-8AFBF2577C17}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Asa</RootNamespace>
<AssemblyName>Asa.PrintLabel</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Management" />
<Reference Include="System.Printing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="zxing, Version=0.16.5.0, Culture=neutral, PublicKeyToken=4e88037ac681fe60, processorArchitecture=MSIL">
<HintPath>..\packages\ZXing.Net.0.16.5\lib\net461\zxing.dll</HintPath>
</Reference>
<Reference Include="zxing.presentation, Version=0.16.5.0, Culture=neutral, PublicKeyToken=4e88037ac681fe60, processorArchitecture=MSIL">
<HintPath>..\packages\ZXing.Net.0.16.5\lib\net461\zxing.presentation.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="LabelPrint.cs" />
<Compile Include="ClassExtend.cs" />
<Compile Include="FormTextBox.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FormTextBox.Designer.cs">
<DependentUpon>FormTextBox.cs</DependentUpon>
</Compile>
<Compile Include="Model.cs" />
<Compile Include="Common.cs" />
<Compile Include="FrmLabel.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmLabel.Designer.cs">
<DependentUpon>FrmLabel.cs</DependentUpon>
</Compile>
<Compile Include="PrintLabel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="FormTextBox.resx">
<DependentUpon>FormTextBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmLabel.resx">
<DependentUpon>FrmLabel.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file \ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("PrintLabel")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PrintLabel")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("b8f25ece-dee6-41d6-8ef0-8afbf2577c17")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ZXing.Net" version="0.16.5" targetFramework="net461" />
</packages>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
\ No newline at end of file \ No newline at end of file
namespace PrintLabel_Test
{
partial class Form1
{
/// <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 Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.textBox2 = new System.Windows.Forms.TextBox();
this.button4 = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.button5 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(154, 127);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(123, 49);
this.button1.TabIndex = 0;
this.button1.Text = "编辑";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(374, 127);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(162, 21);
this.textBox1.TabIndex = 1;
this.textBox1.Text = "test2";
//
// button2
//
this.button2.Location = new System.Drawing.Point(374, 181);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(100, 23);
this.button2.TabIndex = 2;
this.button2.Text = "加载";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(154, 182);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(123, 49);
this.button3.TabIndex = 3;
this.button3.Text = "打印";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(374, 154);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(162, 21);
this.textBox2.TabIndex = 4;
this.textBox2.Text = "ZDesigner GT800 (EPL)";
//
// button4
//
this.button4.Location = new System.Drawing.Point(374, 276);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(100, 23);
this.button4.TabIndex = 5;
this.button4.Text = "获取状态";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(502, 224);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(251, 163);
this.pictureBox1.TabIndex = 6;
this.pictureBox1.TabStop = false;
//
// button5
//
this.button5.Location = new System.Drawing.Point(154, 237);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(123, 47);
this.button5.TabIndex = 7;
this.button5.Text = "button5";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.button5);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.button4);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button button5;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PrintLabel_Test
{
public partial class Form1 : Form
{
private Asa.PrintLabel print;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
print = new Asa.PrintLabel(Application.StartupPath + "\\Label");
print.PrintStatusChanged += Print_PrintStatusChanged;
}
private void Print_PrintStatusChanged(Asa.PrintLabel.PrinterStatus sta, string msg)
{
MessageBox.Show(sta.ToString());
}
private void button1_Click(object sender, EventArgs e)
{
print.EditLabel();
}
private void button2_Click(object sender, EventArgs e)
{
print.LoadLabel(textBox1.Text);
print.Printer(textBox2.Text, false);
}
private void button3_Click(object sender, EventArgs e)
{
Dictionary<string, string> text = new Dictionary<string, string>();
text.Add("aa", "123");
text.Add("bb", "yumtrj");
print.Print(text);
}
private void button4_Click(object sender, EventArgs e)
{
print.GetStatus();
}
private void button5_Click(object sender, EventArgs e)
{
Dictionary<string, string> text = new Dictionary<string, string>();
text.Add("ri", "123123123123123");
text.Add("pn", "yumtr3123123j");
pictureBox1.Image = print.PrintPreview(text);
}
}
}
<?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 \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{857ACBBF-F326-4AD0-AD6F-B7F7479AFE2C}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>PrintLabel_Test</RootNamespace>
<AssemblyName>PrintLabel_Test</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PrintLabel\PrintLabel.csproj">
<Project>{b8f25ece-dee6-41d6-8ef0-8afbf2577c17}</Project>
<Name>PrintLabel</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file \ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PrintLabel_Test
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("PrintLabel_Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PrintLabel_Test")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("857acbbf-f326-4ad0-ad6f-b7f7479afe2c")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace PrintLabel_Test.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PrintLabel_Test.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 覆盖当前线程的 CurrentUICulture 属性
/// 使用此强类型的资源类的资源查找。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file \ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PrintLabel_Test.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!