首次提交:本地项目同步到Gitea

This commit is contained in:
zhusenlin
2026-01-24 08:45:54 +08:00
commit 4a6b23db69
256 changed files with 25311 additions and 0 deletions

View File

@@ -0,0 +1,900 @@
namespace Io.Github.Kerwinxu.LibShapes.Core.Paper
{
partial class FrmPaperSetting
{
/// <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.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPagePaper = new System.Windows.Forms.TabPage();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.comboPrinters = new System.Windows.Forms.ComboBox();
this.groupBox9 = new System.Windows.Forms.GroupBox();
this.comboPaperSizes = new System.Windows.Forms.ComboBox();
this.groupBox7 = new System.Windows.Forms.GroupBox();
this.btn_paper_ok = new System.Windows.Forms.Button();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.label1 = new System.Windows.Forms.Label();
this.txt_paper_width = new System.Windows.Forms.TextBox();
this.label14 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label15 = new System.Windows.Forms.Label();
this.txt_paper_height = new System.Windows.Forms.TextBox();
this.groupBox10 = new System.Windows.Forms.GroupBox();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.tabPageLayout = new System.Windows.Forms.TabPage();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.chkCustomInterval = new System.Windows.Forms.CheckBox();
this.txtHorizontalInterval = new System.Windows.Forms.TextBox();
this.txtVerticalInterval = new System.Windows.Forms.TextBox();
this.label12 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.chkCustomModelSize = new System.Windows.Forms.CheckBox();
this.txtModelWidth = new System.Windows.Forms.TextBox();
this.txtModelHeight = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.txtMaginsTop = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.txtMaginsLeft = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.txtMaginsRight = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
this.txtMaginsBottom = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.UpDownNumberOfColumn = new System.Windows.Forms.NumericUpDown();
this.UpDownNumberOfLine = new System.Windows.Forms.NumericUpDown();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.tabPageShapes = new System.Windows.Forms.TabPage();
this.groupBoxRect = new System.Windows.Forms.GroupBox();
this.chkEllipseHole = new System.Windows.Forms.CheckBox();
this.txtEllipseHoleRadius = new System.Windows.Forms.TextBox();
this.lblEllipseHoleRadius = new System.Windows.Forms.Label();
this.txtRoundRadius = new System.Windows.Forms.TextBox();
this.lblRoundRadius = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.radioButtonRoundRect = new System.Windows.Forms.RadioButton();
this.radioButtonEllipse = new System.Windows.Forms.RadioButton();
this.radioButtonRect = new System.Windows.Forms.RadioButton();
this.btnCancel = new System.Windows.Forms.Button();
this.btnOk = new System.Windows.Forms.Button();
this.lblModelSize = new System.Windows.Forms.Label();
this.lblPaperSize = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.tabControl1.SuspendLayout();
this.tabPagePaper.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout();
this.groupBox6.SuspendLayout();
this.groupBox9.SuspendLayout();
this.groupBox7.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.groupBox10.SuspendLayout();
this.tabPageLayout.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.UpDownNumberOfColumn)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.UpDownNumberOfLine)).BeginInit();
this.tabPageShapes.SuspendLayout();
this.groupBoxRect.SuspendLayout();
this.groupBox5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPagePaper);
this.tabControl1.Controls.Add(this.tabPageLayout);
this.tabControl1.Controls.Add(this.tabPageShapes);
this.tabControl1.Location = new System.Drawing.Point(12, 12);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(318, 419);
this.tabControl1.TabIndex = 1;
//
// tabPagePaper
//
this.tabPagePaper.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.tabPagePaper.Controls.Add(this.flowLayoutPanel1);
this.tabPagePaper.Location = new System.Drawing.Point(4, 22);
this.tabPagePaper.Name = "tabPagePaper";
this.tabPagePaper.Padding = new System.Windows.Forms.Padding(3);
this.tabPagePaper.Size = new System.Drawing.Size(310, 393);
this.tabPagePaper.TabIndex = 0;
this.tabPagePaper.Text = "纸张";
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Controls.Add(this.groupBox6);
this.flowLayoutPanel1.Controls.Add(this.groupBox9);
this.flowLayoutPanel1.Controls.Add(this.groupBox7);
this.flowLayoutPanel1.Controls.Add(this.groupBox10);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(304, 387);
this.flowLayoutPanel1.TabIndex = 0;
//
// groupBox6
//
this.groupBox6.Controls.Add(this.comboPrinters);
this.groupBox6.Location = new System.Drawing.Point(3, 3);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(298, 58);
this.groupBox6.TabIndex = 5;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "打印机";
//
// comboPrinters
//
this.comboPrinters.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboPrinters.FormattingEnabled = true;
this.comboPrinters.Location = new System.Drawing.Point(6, 20);
this.comboPrinters.Name = "comboPrinters";
this.comboPrinters.Size = new System.Drawing.Size(286, 20);
this.comboPrinters.TabIndex = 1;
this.comboPrinters.SelectedIndexChanged += new System.EventHandler(this.comboPrinters_SelectedIndexChanged);
//
// groupBox9
//
this.groupBox9.Controls.Add(this.comboPaperSizes);
this.groupBox9.Location = new System.Drawing.Point(3, 67);
this.groupBox9.Name = "groupBox9";
this.groupBox9.Size = new System.Drawing.Size(298, 58);
this.groupBox9.TabIndex = 4;
this.groupBox9.TabStop = false;
this.groupBox9.Text = "纸张大小";
//
// comboPaperSizes
//
this.comboPaperSizes.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboPaperSizes.FormattingEnabled = true;
this.comboPaperSizes.Location = new System.Drawing.Point(6, 20);
this.comboPaperSizes.Name = "comboPaperSizes";
this.comboPaperSizes.Size = new System.Drawing.Size(286, 20);
this.comboPaperSizes.TabIndex = 1;
this.comboPaperSizes.SelectedValueChanged += new System.EventHandler(this.comboPaperSizes_SelectedValueChanged);
//
// groupBox7
//
this.groupBox7.Controls.Add(this.btn_paper_ok);
this.groupBox7.Controls.Add(this.tableLayoutPanel1);
this.groupBox7.Location = new System.Drawing.Point(3, 131);
this.groupBox7.Name = "groupBox7";
this.groupBox7.Size = new System.Drawing.Size(298, 97);
this.groupBox7.TabIndex = 6;
this.groupBox7.TabStop = false;
this.groupBox7.Text = "纸张自定义";
//
// btn_paper_ok
//
this.btn_paper_ok.Location = new System.Drawing.Point(189, 55);
this.btn_paper_ok.Name = "btn_paper_ok";
this.btn_paper_ok.Size = new System.Drawing.Size(75, 23);
this.btn_paper_ok.TabIndex = 1;
this.btn_paper_ok.Text = "确定";
this.btn_paper_ok.UseVisualStyleBackColor = true;
this.btn_paper_ok.Click += new System.EventHandler(this.btn_paper_ok_Click);
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 3;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 48.3871F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 51.6129F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 31F));
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.txt_paper_width, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.label14, 2, 0);
this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.label15, 2, 1);
this.tableLayoutPanel1.Controls.Add(this.txt_paper_height, 1, 1);
this.tableLayoutPanel1.Location = new System.Drawing.Point(6, 20);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(177, 62);
this.tableLayoutPanel1.TabIndex = 0;
//
// label1
//
this.label1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(14, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 12);
this.label1.TabIndex = 0;
this.label1.Text = "宽度:";
//
// txt_paper_width
//
this.txt_paper_width.Location = new System.Drawing.Point(73, 3);
this.txt_paper_width.Name = "txt_paper_width";
this.txt_paper_width.Size = new System.Drawing.Size(63, 21);
this.txt_paper_width.TabIndex = 2;
//
// label14
//
this.label14.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(152, 9);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(17, 12);
this.label14.TabIndex = 4;
this.label14.Text = "mm";
//
// label2
//
this.label2.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(14, 40);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(41, 12);
this.label2.TabIndex = 1;
this.label2.Text = "高度:";
//
// label15
//
this.label15.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(152, 40);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(17, 12);
this.label15.TabIndex = 5;
this.label15.Text = "mm";
//
// txt_paper_height
//
this.txt_paper_height.Location = new System.Drawing.Point(73, 34);
this.txt_paper_height.Name = "txt_paper_height";
this.txt_paper_height.Size = new System.Drawing.Size(63, 21);
this.txt_paper_height.TabIndex = 3;
//
// groupBox10
//
this.groupBox10.Controls.Add(this.radioButton2);
this.groupBox10.Controls.Add(this.radioButton1);
this.groupBox10.Location = new System.Drawing.Point(3, 234);
this.groupBox10.Name = "groupBox10";
this.groupBox10.Size = new System.Drawing.Size(298, 69);
this.groupBox10.TabIndex = 5;
this.groupBox10.TabStop = false;
this.groupBox10.Text = "方向";
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Location = new System.Drawing.Point(6, 42);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(47, 16);
this.radioButton2.TabIndex = 4;
this.radioButton2.Text = "横向";
this.radioButton2.UseVisualStyleBackColor = true;
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Checked = true;
this.radioButton1.Location = new System.Drawing.Point(6, 20);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(47, 16);
this.radioButton1.TabIndex = 4;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "纵向";
this.radioButton1.UseVisualStyleBackColor = true;
//
// tabPageLayout
//
this.tabPageLayout.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.tabPageLayout.Controls.Add(this.groupBox4);
this.tabPageLayout.Controls.Add(this.groupBox3);
this.tabPageLayout.Controls.Add(this.groupBox2);
this.tabPageLayout.Controls.Add(this.groupBox1);
this.tabPageLayout.Location = new System.Drawing.Point(4, 22);
this.tabPageLayout.Name = "tabPageLayout";
this.tabPageLayout.Padding = new System.Windows.Forms.Padding(3);
this.tabPageLayout.Size = new System.Drawing.Size(310, 393);
this.tabPageLayout.TabIndex = 1;
this.tabPageLayout.Text = "布局";
//
// groupBox4
//
this.groupBox4.Controls.Add(this.chkCustomInterval);
this.groupBox4.Controls.Add(this.txtHorizontalInterval);
this.groupBox4.Controls.Add(this.txtVerticalInterval);
this.groupBox4.Controls.Add(this.label12);
this.groupBox4.Controls.Add(this.label13);
this.groupBox4.Location = new System.Drawing.Point(6, 284);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(291, 100);
this.groupBox4.TabIndex = 19;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "模板间距";
//
// chkCustomInterval
//
this.chkCustomInterval.AutoSize = true;
this.chkCustomInterval.Enabled = false;
this.chkCustomInterval.Location = new System.Drawing.Point(193, 45);
this.chkCustomInterval.Name = "chkCustomInterval";
this.chkCustomInterval.Size = new System.Drawing.Size(72, 16);
this.chkCustomInterval.TabIndex = 18;
this.chkCustomInterval.Text = "手动设置";
this.chkCustomInterval.UseVisualStyleBackColor = true;
this.chkCustomInterval.Visible = false;
this.chkCustomInterval.CheckedChanged += new System.EventHandler(this.chkCustomInterval_CheckedChanged);
//
// txtHorizontalInterval
//
this.txtHorizontalInterval.Enabled = false;
this.txtHorizontalInterval.Location = new System.Drawing.Point(56, 23);
this.txtHorizontalInterval.Name = "txtHorizontalInterval";
this.txtHorizontalInterval.Size = new System.Drawing.Size(76, 21);
this.txtHorizontalInterval.TabIndex = 14;
this.txtHorizontalInterval.Text = "0";
this.txtHorizontalInterval.TextChanged += new System.EventHandler(this.txtHorizontalInterval_TextChanged);
//
// txtVerticalInterval
//
this.txtVerticalInterval.Enabled = false;
this.txtVerticalInterval.Location = new System.Drawing.Point(56, 60);
this.txtVerticalInterval.Name = "txtVerticalInterval";
this.txtVerticalInterval.Size = new System.Drawing.Size(76, 21);
this.txtVerticalInterval.TabIndex = 17;
this.txtVerticalInterval.Text = "0";
this.txtVerticalInterval.TextChanged += new System.EventHandler(this.txtHorizontalInterval_TextChanged);
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(9, 63);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(29, 12);
this.label12.TabIndex = 15;
this.label12.Text = "垂直";
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(9, 26);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(29, 12);
this.label13.TabIndex = 16;
this.label13.Text = "水平";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.chkCustomModelSize);
this.groupBox3.Controls.Add(this.txtModelWidth);
this.groupBox3.Controls.Add(this.txtModelHeight);
this.groupBox3.Controls.Add(this.label4);
this.groupBox3.Controls.Add(this.label7);
this.groupBox3.Location = new System.Drawing.Point(6, 178);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(291, 100);
this.groupBox3.TabIndex = 17;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "模板大小";
//
// chkCustomModelSize
//
this.chkCustomModelSize.AutoSize = true;
this.chkCustomModelSize.Checked = true;
this.chkCustomModelSize.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkCustomModelSize.Location = new System.Drawing.Point(193, 43);
this.chkCustomModelSize.Name = "chkCustomModelSize";
this.chkCustomModelSize.Size = new System.Drawing.Size(72, 16);
this.chkCustomModelSize.TabIndex = 18;
this.chkCustomModelSize.Text = "手动设置";
this.chkCustomModelSize.UseVisualStyleBackColor = true;
this.chkCustomModelSize.CheckedChanged += new System.EventHandler(this.chkCustomModelSize_CheckedChanged);
//
// txtModelWidth
//
this.txtModelWidth.Location = new System.Drawing.Point(53, 23);
this.txtModelWidth.Name = "txtModelWidth";
this.txtModelWidth.Size = new System.Drawing.Size(76, 21);
this.txtModelWidth.TabIndex = 14;
this.txtModelWidth.Text = "10";
this.txtModelWidth.TextChanged += new System.EventHandler(this.txtModelWidth_TextChanged);
//
// txtModelHeight
//
this.txtModelHeight.Location = new System.Drawing.Point(53, 60);
this.txtModelHeight.Name = "txtModelHeight";
this.txtModelHeight.Size = new System.Drawing.Size(76, 21);
this.txtModelHeight.TabIndex = 17;
this.txtModelHeight.Text = "10";
this.txtModelHeight.TextChanged += new System.EventHandler(this.txtModelWidth_TextChanged);
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(9, 63);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(29, 12);
this.label4.TabIndex = 15;
this.label4.Text = "高度";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(9, 26);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(29, 12);
this.label7.TabIndex = 16;
this.label7.Text = "宽度";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.txtMaginsTop);
this.groupBox2.Controls.Add(this.label8);
this.groupBox2.Controls.Add(this.label9);
this.groupBox2.Controls.Add(this.txtMaginsLeft);
this.groupBox2.Controls.Add(this.label10);
this.groupBox2.Controls.Add(this.txtMaginsRight);
this.groupBox2.Controls.Add(this.label11);
this.groupBox2.Controls.Add(this.txtMaginsBottom);
this.groupBox2.Location = new System.Drawing.Point(3, 76);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(291, 96);
this.groupBox2.TabIndex = 16;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "边距";
//
// txtMaginsTop
//
this.txtMaginsTop.Location = new System.Drawing.Point(56, 20);
this.txtMaginsTop.Name = "txtMaginsTop";
this.txtMaginsTop.Size = new System.Drawing.Size(76, 21);
this.txtMaginsTop.TabIndex = 6;
this.txtMaginsTop.Text = "0";
this.txtMaginsTop.TextChanged += new System.EventHandler(this.txtMaginsTop_TextChanged);
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(149, 60);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(17, 12);
this.label8.TabIndex = 7;
this.label8.Text = "右";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(12, 60);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(17, 12);
this.label9.TabIndex = 8;
this.label9.Text = "下";
//
// txtMaginsLeft
//
this.txtMaginsLeft.Location = new System.Drawing.Point(196, 20);
this.txtMaginsLeft.Name = "txtMaginsLeft";
this.txtMaginsLeft.Size = new System.Drawing.Size(76, 21);
this.txtMaginsLeft.TabIndex = 13;
this.txtMaginsLeft.Text = "0";
this.txtMaginsLeft.TextChanged += new System.EventHandler(this.txtMaginsTop_TextChanged);
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(149, 23);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(17, 12);
this.label10.TabIndex = 9;
this.label10.Text = "左";
//
// txtMaginsRight
//
this.txtMaginsRight.Location = new System.Drawing.Point(196, 57);
this.txtMaginsRight.Name = "txtMaginsRight";
this.txtMaginsRight.Size = new System.Drawing.Size(76, 21);
this.txtMaginsRight.TabIndex = 12;
this.txtMaginsRight.Text = "0";
this.txtMaginsRight.TextChanged += new System.EventHandler(this.txtMaginsTop_TextChanged);
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(12, 23);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(17, 12);
this.label11.TabIndex = 10;
this.label11.Text = "上";
//
// txtMaginsBottom
//
this.txtMaginsBottom.Location = new System.Drawing.Point(56, 57);
this.txtMaginsBottom.Name = "txtMaginsBottom";
this.txtMaginsBottom.Size = new System.Drawing.Size(76, 21);
this.txtMaginsBottom.TabIndex = 11;
this.txtMaginsBottom.Text = "0";
this.txtMaginsBottom.TextChanged += new System.EventHandler(this.txtMaginsTop_TextChanged);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.UpDownNumberOfColumn);
this.groupBox1.Controls.Add(this.UpDownNumberOfLine);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Location = new System.Drawing.Point(3, 6);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(296, 64);
this.groupBox1.TabIndex = 15;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "布局";
//
// UpDownNumberOfColumn
//
this.UpDownNumberOfColumn.Location = new System.Drawing.Point(196, 20);
this.UpDownNumberOfColumn.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.UpDownNumberOfColumn.Name = "UpDownNumberOfColumn";
this.UpDownNumberOfColumn.Size = new System.Drawing.Size(76, 21);
this.UpDownNumberOfColumn.TabIndex = 6;
this.UpDownNumberOfColumn.Value = new decimal(new int[] {
2,
0,
0,
0});
this.UpDownNumberOfColumn.ValueChanged += new System.EventHandler(this.UpDownNumberOfLine_ValueChanged);
//
// UpDownNumberOfLine
//
this.UpDownNumberOfLine.Location = new System.Drawing.Point(56, 21);
this.UpDownNumberOfLine.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.UpDownNumberOfLine.Name = "UpDownNumberOfLine";
this.UpDownNumberOfLine.Size = new System.Drawing.Size(76, 21);
this.UpDownNumberOfLine.TabIndex = 5;
this.UpDownNumberOfLine.Value = new decimal(new int[] {
2,
0,
0,
0});
this.UpDownNumberOfLine.ValueChanged += new System.EventHandler(this.UpDownNumberOfLine_ValueChanged);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(12, 23);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(41, 12);
this.label5.TabIndex = 1;
this.label5.Text = "行数:";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(149, 23);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(41, 12);
this.label6.TabIndex = 2;
this.label6.Text = "列数:";
//
// tabPageShapes
//
this.tabPageShapes.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.tabPageShapes.Controls.Add(this.groupBoxRect);
this.tabPageShapes.Controls.Add(this.groupBox5);
this.tabPageShapes.Location = new System.Drawing.Point(4, 22);
this.tabPageShapes.Name = "tabPageShapes";
this.tabPageShapes.Padding = new System.Windows.Forms.Padding(3);
this.tabPageShapes.Size = new System.Drawing.Size(310, 393);
this.tabPageShapes.TabIndex = 2;
this.tabPageShapes.Text = "形状";
//
// groupBoxRect
//
this.groupBoxRect.Controls.Add(this.chkEllipseHole);
this.groupBoxRect.Controls.Add(this.txtEllipseHoleRadius);
this.groupBoxRect.Controls.Add(this.lblEllipseHoleRadius);
this.groupBoxRect.Controls.Add(this.txtRoundRadius);
this.groupBoxRect.Controls.Add(this.lblRoundRadius);
this.groupBoxRect.Location = new System.Drawing.Point(6, 119);
this.groupBoxRect.Name = "groupBoxRect";
this.groupBoxRect.Size = new System.Drawing.Size(298, 139);
this.groupBoxRect.TabIndex = 1;
this.groupBoxRect.TabStop = false;
this.groupBoxRect.Text = "选项";
//
// chkEllipseHole
//
this.chkEllipseHole.AutoSize = true;
this.chkEllipseHole.Location = new System.Drawing.Point(15, 73);
this.chkEllipseHole.Name = "chkEllipseHole";
this.chkEllipseHole.Size = new System.Drawing.Size(36, 16);
this.chkEllipseHole.TabIndex = 7;
this.chkEllipseHole.Text = "孔";
this.chkEllipseHole.UseVisualStyleBackColor = true;
//
// txtEllipseHoleRadius
//
this.txtEllipseHoleRadius.Location = new System.Drawing.Point(72, 95);
this.txtEllipseHoleRadius.Name = "txtEllipseHoleRadius";
this.txtEllipseHoleRadius.Size = new System.Drawing.Size(100, 21);
this.txtEllipseHoleRadius.TabIndex = 5;
//
// lblEllipseHoleRadius
//
this.lblEllipseHoleRadius.AutoSize = true;
this.lblEllipseHoleRadius.Location = new System.Drawing.Point(34, 98);
this.lblEllipseHoleRadius.Name = "lblEllipseHoleRadius";
this.lblEllipseHoleRadius.Size = new System.Drawing.Size(29, 12);
this.lblEllipseHoleRadius.TabIndex = 4;
this.lblEllipseHoleRadius.Text = "孔径";
//
// txtRoundRadius
//
this.txtRoundRadius.Location = new System.Drawing.Point(72, 42);
this.txtRoundRadius.Name = "txtRoundRadius";
this.txtRoundRadius.Size = new System.Drawing.Size(100, 21);
this.txtRoundRadius.TabIndex = 2;
//
// lblRoundRadius
//
this.lblRoundRadius.AutoSize = true;
this.lblRoundRadius.Location = new System.Drawing.Point(13, 48);
this.lblRoundRadius.Name = "lblRoundRadius";
this.lblRoundRadius.Size = new System.Drawing.Size(53, 12);
this.lblRoundRadius.TabIndex = 1;
this.lblRoundRadius.Text = "圆角半径";
//
// groupBox5
//
this.groupBox5.Controls.Add(this.radioButtonRoundRect);
this.groupBox5.Controls.Add(this.radioButtonEllipse);
this.groupBox5.Controls.Add(this.radioButtonRect);
this.groupBox5.Location = new System.Drawing.Point(6, 18);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(298, 95);
this.groupBox5.TabIndex = 0;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "模板形状";
//
// radioButtonRoundRect
//
this.radioButtonRoundRect.AutoSize = true;
this.radioButtonRoundRect.Location = new System.Drawing.Point(15, 44);
this.radioButtonRoundRect.Name = "radioButtonRoundRect";
this.radioButtonRoundRect.Size = new System.Drawing.Size(71, 16);
this.radioButtonRoundRect.TabIndex = 2;
this.radioButtonRoundRect.Text = "圆角矩形";
this.radioButtonRoundRect.UseVisualStyleBackColor = true;
this.radioButtonRoundRect.CheckedChanged += new System.EventHandler(this.radioButtonRect_CheckedChanged);
//
// radioButtonEllipse
//
this.radioButtonEllipse.AutoSize = true;
this.radioButtonEllipse.Location = new System.Drawing.Point(15, 66);
this.radioButtonEllipse.Name = "radioButtonEllipse";
this.radioButtonEllipse.Size = new System.Drawing.Size(47, 16);
this.radioButtonEllipse.TabIndex = 1;
this.radioButtonEllipse.Text = "椭圆";
this.radioButtonEllipse.UseVisualStyleBackColor = true;
this.radioButtonEllipse.CheckedChanged += new System.EventHandler(this.radioButtonRect_CheckedChanged);
//
// radioButtonRect
//
this.radioButtonRect.AutoSize = true;
this.radioButtonRect.Checked = true;
this.radioButtonRect.Location = new System.Drawing.Point(15, 20);
this.radioButtonRect.Name = "radioButtonRect";
this.radioButtonRect.Size = new System.Drawing.Size(47, 16);
this.radioButtonRect.TabIndex = 0;
this.radioButtonRect.TabStop = true;
this.radioButtonRect.Text = "方框";
this.radioButtonRect.UseVisualStyleBackColor = true;
this.radioButtonRect.CheckedChanged += new System.EventHandler(this.radioButtonRect_CheckedChanged);
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(447, 437);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 15;
this.btnCancel.Text = "取消";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnOk
//
this.btnOk.Location = new System.Drawing.Point(140, 437);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(75, 23);
this.btnOk.TabIndex = 14;
this.btnOk.Text = "确定";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// lblModelSize
//
this.lblModelSize.AutoSize = true;
this.lblModelSize.Location = new System.Drawing.Point(366, 402);
this.lblModelSize.Name = "lblModelSize";
this.lblModelSize.Size = new System.Drawing.Size(65, 12);
this.lblModelSize.TabIndex = 13;
this.lblModelSize.Text = "模板大小:";
//
// lblPaperSize
//
this.lblPaperSize.AutoSize = true;
this.lblPaperSize.Location = new System.Drawing.Point(366, 376);
this.lblPaperSize.Name = "lblPaperSize";
this.lblPaperSize.Size = new System.Drawing.Size(65, 12);
this.lblPaperSize.TabIndex = 12;
this.lblPaperSize.Text = "纸张尺寸:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(331, 20);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(29, 12);
this.label3.TabIndex = 11;
this.label3.Text = "预览";
//
// pictureBox1
//
this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBox1.Location = new System.Drawing.Point(331, 38);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(336, 335);
this.pictureBox1.TabIndex = 10;
this.pictureBox1.TabStop = false;
this.pictureBox1.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBox1_Paint);
//
// FrmPaperSetting
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(677, 475);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.lblModelSize);
this.Controls.Add(this.lblPaperSize);
this.Controls.Add(this.label3);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.tabControl1);
this.Name = "FrmPaperSetting";
this.Text = "纸张设置";
this.tabControl1.ResumeLayout(false);
this.tabPagePaper.ResumeLayout(false);
this.flowLayoutPanel1.ResumeLayout(false);
this.groupBox6.ResumeLayout(false);
this.groupBox9.ResumeLayout(false);
this.groupBox7.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.groupBox10.ResumeLayout(false);
this.groupBox10.PerformLayout();
this.tabPageLayout.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.UpDownNumberOfColumn)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.UpDownNumberOfLine)).EndInit();
this.tabPageShapes.ResumeLayout(false);
this.groupBoxRect.ResumeLayout(false);
this.groupBoxRect.PerformLayout();
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPagePaper;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.ComboBox comboPrinters;
private System.Windows.Forms.GroupBox groupBox9;
private System.Windows.Forms.ComboBox comboPaperSizes;
private System.Windows.Forms.GroupBox groupBox7;
private System.Windows.Forms.Button btn_paper_ok;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txt_paper_width;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.TextBox txt_paper_height;
private System.Windows.Forms.GroupBox groupBox10;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.TabPage tabPageLayout;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.CheckBox chkCustomInterval;
private System.Windows.Forms.TextBox txtHorizontalInterval;
private System.Windows.Forms.TextBox txtVerticalInterval;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.CheckBox chkCustomModelSize;
private System.Windows.Forms.TextBox txtModelWidth;
private System.Windows.Forms.TextBox txtModelHeight;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox txtMaginsTop;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox txtMaginsLeft;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox txtMaginsRight;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.TextBox txtMaginsBottom;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.NumericUpDown UpDownNumberOfColumn;
private System.Windows.Forms.NumericUpDown UpDownNumberOfLine;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TabPage tabPageShapes;
private System.Windows.Forms.GroupBox groupBoxRect;
private System.Windows.Forms.CheckBox chkEllipseHole;
private System.Windows.Forms.TextBox txtEllipseHoleRadius;
private System.Windows.Forms.Label lblEllipseHoleRadius;
private System.Windows.Forms.TextBox txtRoundRadius;
private System.Windows.Forms.Label lblRoundRadius;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.RadioButton radioButtonRoundRect;
private System.Windows.Forms.RadioButton radioButtonEllipse;
private System.Windows.Forms.RadioButton radioButtonRect;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Label lblModelSize;
private System.Windows.Forms.Label lblPaperSize;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.PictureBox pictureBox1;
}
}

View File

@@ -0,0 +1,381 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Printing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Io.Github.Kerwinxu.LibShapes.Core.Paper
{
public partial class FrmPaperSetting : Form , IPaperSetting
{
/// <summary>
/// 修改的是这个变量
/// </summary>
private Paper paper = new Paper();
/// <summary>
/// 这个是要返回的
/// </summary>
private Paper result;
public FrmPaperSetting()
{
InitializeComponent();
init_printer();
}
public FrmPaperSetting(Paper paper):this()
{
this.paper = paper;
isOnlyOne = true;
paper_to_ui();
isOnlyOne = false;
}
/// <summary>
/// 初始化打印机
/// </summary>
private void init_printer()
{
foreach (var item in PrinterSettings.InstalledPrinters)
{
comboPrinters.Items.Add(item);
}
}
public Paper GetPaper()
{
return this.result;
//throw new NotImplementedException();
}
private bool isOnlyOne;
/// <summary>
/// 界面上数据发生改变
/// </summary>
private void change()
{
// 有这个标志,表示当前只能有一个在修改。
if (isOnlyOne)
{
return;
}
isOnlyOne = true;
// 先更新数据
if (ui_to_paper() && compute())
{
paper_to_ui(); // 然后计算,最后更新到界面
this.pictureBox1.Refresh();
this.lblModelSize.Text = $"模板大小:{this.paper.ModelWidth} * {this.paper.ModelHeight}";
this.lblPaperSize.Text = $"纸张大小:{this.paper.PaperWidth} * {this.paper.PaperHeight}";
}
isOnlyOne = false;
}
private bool compute()
{
// 我这里简化一下,自定义模板尺寸和自定义模板的间距,两个得有一个是可以手动设置,而另一个是自动的
// 解方程 纸张的宽度 = 左边距 + 列数 * 模板的宽度 + (列数-1*模板的间距 + 右边距
if (!chkCustomModelSize.Checked)
{
// 这个模板间距是手动设置的,那么我就要计算的是模板的大小了
this.paper.ModelWidth = (this.paper.PaperWidth - this.paper.Left - this.paper.Right - (this.paper.Cols - 1) * this.paper.HorizontalIntervalDistance) / this.paper.Cols;
this.paper.ModelHeight = (this.paper.PaperHeight - this.paper.Top - this.paper.Bottom - (this.paper.Rows - 1) * this.paper.VerticalIntervalDistance) / this.paper.Rows;
if (this.paper.ModelHeight < 0 || this.paper.ModelWidth < 0)
{
return false;
}
}
// 这里暂时只支持是否手动更改模板的尺寸,不支持自动计算模板间距。
//else
//{
// // 自定义了模板,要求的是模板的边距了
// // 这里要判断是否是一行或者一列
// if(this.paper.Cols == 1)
// {
// this.paper.HorizontalIntervalDistance = 0;
// }
// else
// {
// this.paper.HorizontalIntervalDistance = (this.paper.PaperWidth - this.paper.Left - this.paper.Right - this.paper.Cols * this.paper.ModelWidth) / (this.paper.Cols - 1);
// }
// if (this.paper.Rows == 1)
// {
// this.paper.VerticalIntervalDistance = 0;
// }
// else
// {
// this.paper.VerticalIntervalDistance = (this.paper.PaperHeight - this.paper.Top - this.paper.Bottom - this.paper.Rows * this.paper.ModelHeight) / (this.paper.Rows - 1);
// }
// if (this.paper.HorizontalIntervalDistance < 0 || this.paper.VerticalIntervalDistance < 0)
// {
// return false;
// }
//}
return true;
}
private bool ui_to_paper()
{
// 这里将ui中的信息全部转到paper中
try
{
this.paper.PaperWidth = float.Parse(txt_paper_width.Text);
this.paper.PaperHeight = float.Parse(txt_paper_height.Text);
this.paper.Landscape = !radioButton1.Checked;// 纵向
this.paper.Rows = (int)UpDownNumberOfLine.Value;
this.paper.Cols = (int)UpDownNumberOfColumn.Value;
this.paper.Top = float.Parse(txtMaginsTop.Text);
this.paper.Bottom = float.Parse(txtMaginsBottom.Text);
this.paper.Left = float.Parse(txtMaginsLeft.Text);
this.paper.Right = float.Parse(txtMaginsRight.Text);
//
this.paper.ModelWidth = float.Parse(txtModelWidth.Text);
this.paper.ModelHeight = float.Parse(txtModelHeight.Text);
//
this.paper.HorizontalIntervalDistance = float.Parse(txtHorizontalInterval.Text);
this.paper.VerticalIntervalDistance = float.Parse(txtVerticalInterval.Text);
if (radioButtonRect.Checked)
{
this.paper.ModelShape = new Shape.ShapeRectangle(); // 矩形
}else if (radioButtonRoundRect.Checked)
{
this.paper.ModelShape = new Shape.ShapeRoundedRectangle(); // 圆角矩形
}
else
{
this.paper.ModelShape = new Shape.ShapeEllipse(); // 椭圆
}
// 设置填充白色
this.paper.ModelShape.IsFill = true;
this.paper.ModelShape.FillColor = Color.White;
// 设置这个纸张的宽和高
this.paper.ModelShape.Height = this.paper.ModelHeight;
this.paper.ModelShape.Width = this.paper.ModelWidth;
return true;
}
catch (Exception ex)
{
MessageBox.Show("转换失败:" + ex.Message);
return false;
//throw;
}
}
private void paper_to_ui()
{
txt_paper_width.Text = this.paper.PaperWidth.ToString();
txt_paper_height.Text = this.paper.PaperHeight.ToString();
if (this.paper.Landscape) radioButton2.Checked = true; else radioButton1.Checked = true;
UpDownNumberOfLine.Value = this.paper.Rows;
UpDownNumberOfColumn.Value = this.paper.Cols;
txtMaginsTop.Text = this.paper.Top.ToString();
txtMaginsBottom.Text = this.paper.Bottom.ToString();
txtMaginsLeft.Text = this.paper.Left.ToString();
txtMaginsRight.Text = this.paper.Right.ToString();
txtModelWidth.Text = this.paper.ModelWidth.ToString();
txtModelHeight.Text = this.paper.ModelHeight.ToString();
txtHorizontalInterval.Text = this.paper.HorizontalIntervalDistance.ToString();
txtVerticalInterval.Text = this.paper.VerticalIntervalDistance.ToString();
if (this.paper.ModelShape is Shape.ShapeRectangle)
{
radioButtonRect.Checked = true;
}
else if (this.paper.ModelShape is Shape.ShapeRoundedRectangle)
{
radioButtonRoundRect.Checked = true;
}
else
{
radioButtonEllipse.Checked = true;
}
}
Dictionary<string, System.Drawing.Printing.PaperSize> dict_paperSize = new Dictionary<string, PaperSize>();
private void comboPrinters_SelectedIndexChanged(object sender, EventArgs e)
{
dict_paperSize.Clear();
// 打印机更改后需要更改有多少的纸张。
PrintDocument printDocument = new PrintDocument();
printDocument.PrinterSettings.PrinterName = comboPrinters.Text;// 打印机的名称
foreach (System.Drawing.Printing.PaperSize item in printDocument.PrinterSettings.PaperSizes)
{
dict_paperSize[item.ToString()] = item;
}
// 加载到组合框
string _old = comboPaperSizes.Text;
comboPaperSizes.Items.Clear();
comboPaperSizes.Items.AddRange(dict_paperSize.Keys.ToArray());
// 我这里看看是否有这个纸张
if (dict_paperSize.ContainsKey(_old))
{
//comboPaperSizes.Text = _old;
}
else
{
// 这里有新的纸张
comboPaperSizes.SelectedIndex = 0;
}
}
private void comboPaperSizes_SelectedValueChanged(object sender, EventArgs e)
{
if (dict_paperSize.ContainsKey(comboPaperSizes.Text))
{
var _papersize = dict_paperSize[comboPaperSizes.Text];
// 请注意,这里边的单位是以百分之一英寸为单位
txt_paper_height.Text = (_papersize.Height*0.254).ToString();
txt_paper_width.Text = (_papersize.Width*0.254).ToString();
change();
}
}
private void chkCustomInterval_CheckedChanged(object sender, EventArgs e)
{
txtHorizontalInterval.Enabled = chkCustomInterval.Checked;
txtVerticalInterval.Enabled = chkCustomInterval.Checked;
if (chkCustomInterval.Checked)
{
chkCustomModelSize.Checked = false;
}
}
private void chkCustomModelSize_CheckedChanged(object sender, EventArgs e)
{
// 这里要变成灰色的
txtModelHeight.Enabled = chkCustomModelSize.Checked;
txtModelWidth.Enabled = chkCustomModelSize.Checked;
if (chkCustomModelSize.Checked)
{
chkCustomInterval.Checked = false;
}
}
private void btn_paper_ok_Click(object sender, EventArgs e)
{
change();
}
private void UpDownNumberOfLine_ValueChanged(object sender, EventArgs e)
{
change();
}
private void txtMaginsTop_TextChanged(object sender, EventArgs e)
{
change();
}
private void txtModelWidth_TextChanged(object sender, EventArgs e)
{
// 要判断是否是手动
if(chkCustomModelSize.Checked) change();
}
private void txtHorizontalInterval_TextChanged(object sender, EventArgs e)
{
// 要判断是否是手动
if (chkCustomInterval.Checked) change();
}
private void btnOk_Click(object sender, EventArgs e)
{
//
this.DialogResult = DialogResult.OK; // 返回ok
this.Close(); // 关闭
result = paper; // 设置这个要返回的。
}
private void radioButtonRect_CheckedChanged(object sender, EventArgs e)
{
change();
}
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
try
{
// 做一个图形
Shapes shapes = new Shapes();
// 做一张纸
Shape.ShapeRectangle rect1 = new Shape.ShapeRectangle()
{
X = 0,
Y = 0,
Width = this.paper.PaperWidth, // todo 这里要注意横向
Height = this.paper.PaperHeight,
PenColor = Color.Red,
PenWidth = 1,
IsFill = true,
FillColor = Color.White,
};
shapes.lstShapes.Add(rect1);
////如下是绘制模板。
for (int i = 0; i < this.paper.Cols; i++)
{
for (int j = 0; j < this.paper.Rows; j++)
{
var tmp = this.paper.ModelShape.DeepClone();
tmp.X = this.paper.Left + i * (this.paper.ModelWidth + this.paper.HorizontalIntervalDistance);
tmp.Y = this.paper.Top + j * (this.paper.ModelHeight + this.paper.VerticalIntervalDistance);
tmp.Width = this.paper.ModelWidth;
tmp.Height = this.paper.ModelHeight;
tmp.PenColor = Color.Black;
tmp.PenWidth = 1;
tmp.IsFill = true;
tmp.FillColor = Color.AliceBlue;
shapes.lstShapes.Add(tmp);
}
}
// 这里做一个放大
shapes.zoomTo(e.Graphics.DpiX, e.Graphics.DpiY, this.pictureBox1.Width, this.pictureBox1.Height, 5);
// 显示
shapes.Draw(e.Graphics, shapes.GetMatrix(), false);
}
catch (Exception)
{
//throw;
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=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>

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Io.Github.Kerwinxu.LibShapes.Core.Paper
{
/// <summary>
/// 取得纸张设置的接口
/// </summary>
interface IPaperSetting
{
/// <summary>
/// 取得纸张的信息
/// </summary>
/// <returns></returns>
Paper GetPaper();
}
}

View File

@@ -0,0 +1,124 @@
using Io.Github.Kerwinxu.LibShapes.Core.Shape;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
namespace Io.Github.Kerwinxu.LibShapes.Core.Paper
{
/// <summary>
/// 纸张尺寸的
/// </summary>
public class Paper
{
/// <summary>
/// 纸张宽度
/// </summary>
[DescriptionAttribute("纸张宽度"), DisplayName("纸张宽度"), CategoryAttribute("纸张")]
public float PaperWidth { get; set; }
/// <summary>
/// 纸张高度
/// </summary>
[DescriptionAttribute("纸张高度"), DisplayName("纸张高度"), CategoryAttribute("纸张")]
public float PaperHeight { get; set; }
/// <summary>
/// 上边距
/// </summary>
[DescriptionAttribute("上边距"), DisplayName("上边距"), CategoryAttribute("边距")]
public float Top { get; set; }
/// <summary>
/// 左边距
/// </summary>
[DescriptionAttribute("左边距"), DisplayName("左边距"), CategoryAttribute("边距")]
public float Left { get; set; }
/// <summary>
/// 右边距
/// </summary>
[DescriptionAttribute("右边距"), DisplayName("右边距"), CategoryAttribute("边距")]
public float Right { get; set; }
/// <summary>
/// 下边距
/// </summary>
[DescriptionAttribute("下边距"), DisplayName("下边距"), CategoryAttribute("边距")]
public float Bottom { get; set; }
/// <summary>
/// 行数
/// </summary>
[DescriptionAttribute("一张纸上的模板的行数"), DisplayName("行数"), CategoryAttribute("模板")]
public int Rows { get; set; }
/// <summary>
/// 列数
/// </summary>
[DescriptionAttribute("一张纸上的模板的列数"), DisplayName("列数"), CategoryAttribute("模板")]
public int Cols { get; set; }
/// <summary>
/// 水平间隔
/// </summary>
[DescriptionAttribute("模板之间的水平间隔"), DisplayName("水平间隔"), CategoryAttribute("模板")]
public float HorizontalIntervalDistance { get; set; }
/// <summary>
/// 竖直间隔
/// </summary>
[DescriptionAttribute("模板之间的竖直间隔"), DisplayName("竖直间隔"), CategoryAttribute("模板")]
public float VerticalIntervalDistance { get; set; }
/// <summary>
/// 模板宽度
/// </summary>
[DescriptionAttribute("模板之间的模板宽度"), DisplayName("模板宽度"), CategoryAttribute("模板")]
public float ModelWidth { get; set; }
/// <summary>
/// 模板高度
/// </summary>
[DescriptionAttribute("模板之间的模板高度"), DisplayName("模板高度"), CategoryAttribute("模板")]
public float ModelHeight { get; set; }
/// <summary>
/// 横向打印
/// </summary>
[DescriptionAttribute("如果页面应横向打印,则为 true反之则为 false。 默认值由打印机决定。"), DisplayName("横向打印"), CategoryAttribute("打印机")]
public bool Landscape { get; set; }
/// <summary>
/// 横向方向的角度
/// </summary>
[DescriptionAttribute("有效的旋转值为 90 度和 270 度。 如果不支持横向,则唯一有效的旋转值为 0 度"), DisplayName("横向方向的角度"), CategoryAttribute("打印机")]
public int LandscapeAngle { get; set; }
/// <summary>
/// 模板的形状
/// </summary>
[Browsable(false)]//不在PropertyGrid上显示
public ShapeEle ModelShape;
//public void createModelShape()
//{
// // 这个是生成一个特殊的
// ModelShape = new ShapeRectangle()
// {
// X = 0,
// Y = 0,
// Width = ModelWidth,
// Height = ModelHeight,
// IsFill = true, // 填充
// FillColor = Color.White, // 填充白色。
// };
//}
public Paper()
{
//createModelShape(); // 默认创建一个空白的。
}
}
}