add-打印机服务添加空白页参数

dev
liuwf 2 weeks ago
parent ea1e832790
commit c878077bc9

@ -48,6 +48,16 @@ namespace PrintBarCode.Helper
/// <summary>
//是否打印空白页,1打印0不打印
/// </summary>
public string BlankFlag
{
get { return iniHelper.IniReadValue("system", "BlankFlag"); }
set { iniHelper.IniWriteValue("system", "BlankFlag", value); }
}
}
}

@ -141,6 +141,10 @@ namespace PrintBarCode.Helper
private string ZPLStr(string data, string name, float Size = 9f)
{
if(Size <=15f)
{
Size = 15f;
}
Bitmap bitmap = CreateImage(data, new Font("黑体", Size, FontStyle.Bold));
string text = ((bitmap.Size.Width / 8 + ((bitmap.Size.Width % 8 != 0) ? 1 : 0)) * bitmap.Size.Height).ToString();
string text2 = (bitmap.Size.Width / 8 + ((bitmap.Size.Width % 8 != 0) ? 1 : 0)).ToString();

@ -31,6 +31,9 @@
label1 = new Label();
logList = new ListBox();
label2 = new Label();
button1 = new Button();
label3 = new Label();
BlankFlag = new Label();
SuspendLayout();
//
// label1
@ -47,7 +50,7 @@
// logList
//
logList.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
logList.BackColor = SystemColors.InactiveCaption;
logList.BackColor = Color.Gainsboro;
logList.Font = new Font("Microsoft YaHei UI", 14.25F, FontStyle.Bold, GraphicsUnit.Point);
logList.ForeColor = Color.ForestGreen;
logList.FormattingEnabled = true;
@ -55,7 +58,7 @@
logList.ItemHeight = 26;
logList.Location = new Point(0, 157);
logList.Name = "logList";
logList.Size = new Size(1454, 654);
logList.Size = new Size(1454, 680);
logList.TabIndex = 1;
//
// label2
@ -69,12 +72,49 @@
label2.TabIndex = 2;
label2.Text = "打印日志:";
//
// button1
//
button1.BackColor = Color.MediumAquamarine;
button1.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
button1.Location = new Point(1257, 113);
button1.Name = "button1";
button1.Size = new Size(83, 38);
button1.TabIndex = 3;
button1.Text = "修 改";
button1.UseVisualStyleBackColor = false;
button1.Click += button1_Click;
//
// label3
//
label3.AutoSize = true;
label3.BackColor = SystemColors.ActiveCaption;
label3.Font = new Font("Microsoft YaHei UI", 15F, FontStyle.Bold, GraphicsUnit.Point);
label3.ForeColor = Color.Green;
label3.Location = new Point(1006, 118);
label3.Name = "label3";
label3.Size = new Size(198, 27);
label3.TabIndex = 4;
label3.Text = "结束是否打印空白页:";
//
// BlankFlag
//
BlankFlag.AutoSize = true;
BlankFlag.Font = new Font("Microsoft YaHei UI", 14.25F, FontStyle.Regular, GraphicsUnit.Point);
BlankFlag.ForeColor = Color.Blue;
BlankFlag.Location = new Point(1210, 119);
BlankFlag.Name = "BlankFlag";
BlankFlag.Size = new Size(0, 25);
BlankFlag.TabIndex = 5;
//
// MainForm
//
AutoScaleDimensions = new SizeF(7F, 17F);
AutoScaleMode = AutoScaleMode.Font;
BackColor = SystemColors.ActiveCaption;
ClientSize = new Size(1454, 811);
ClientSize = new Size(1454, 837);
Controls.Add(BlankFlag);
Controls.Add(label3);
Controls.Add(button1);
Controls.Add(label2);
Controls.Add(logList);
Controls.Add(label1);
@ -92,5 +132,8 @@
private Label label1;
private ListBox logList;
private Label label2;
private Button button1;
private Label label3;
private Label BlankFlag;
}
}

@ -9,7 +9,7 @@ namespace PrintBarCode
{
public partial class MainForm : Form
{
private DebugConfig debugConfig = DebugConfig.Instance;
public MainForm()
{
@ -18,6 +18,7 @@ namespace PrintBarCode
addLog("启动监听打印服务成功......");
BlankFlag.Text = debugConfig.BlankFlag=="1"?"ÊÇ":"·ñ";
}
@ -50,11 +51,13 @@ namespace PrintBarCode
e.Cancel = true;
// 将窗口状态设置为最小化
this.WindowState = FormWindowState.Minimized;
}
}
private void button1_Click(object sender, EventArgs e)
{
debugConfig.BlankFlag = debugConfig.BlankFlag == "1" ? "0" : "1";
BlankFlag.Text = debugConfig.BlankFlag == "1" ? "ÊÇ" : "·ñ";
}
}
}

@ -124,7 +124,7 @@ namespace PrintBarCode
}
else
{
if(IsPrintBlank == 1)
if(IsPrintBlank == 1 && debugConfig.BlankFlag=="1")
{
printBusiness.PrintBlankPage();
IsPrintBlank = 0;
@ -135,6 +135,7 @@ namespace PrintBarCode
catch (Exception ex)
{
Console.WriteLine("处理消息时发生错误");
IsPrintBlank = 0;
}
}
});

@ -20,6 +20,7 @@
<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="materialdesignthemes" Version="5.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
</ItemGroup>

Loading…
Cancel
Save