⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 C# 製做的PDF417二維條碼生成程序,可根據輸入的資料自動生成二維條碼
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Sample
{
	/// <summary>
	/// Descripci髇 breve de Form1.
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
        private aTiRuZ.PDF417.BarcodePDF417 barcodePDF4171;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Button button3;
        private System.Windows.Forms.Button button4;
        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.SaveFileDialog saveFileDialog1;
		/// <summary>
		/// Variable del dise馻dor requerida.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form1()
		{
			//
			// Necesario para admitir el Dise馻dor de Windows Forms
			//
			InitializeComponent();

			//
			// TODO: agregar c骴igo de constructor despu閟 de llamar a InitializeComponent
			//
		}

		/// <summary>
		/// Limpiar los recursos que se est閚 utilizando.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region C骴igo generado por el Dise馻dor de Windows Forms
		/// <summary>
		/// M閠odo necesario para admitir el Dise馻dor. No se puede modificar
		/// el contenido del m閠odo con el editor de c骴igo.
		/// </summary>
		private void InitializeComponent()
		{
            this.barcodePDF4171 = new aTiRuZ.PDF417.BarcodePDF417();
            this.button1 = new System.Windows.Forms.Button();
            this.button3 = new System.Windows.Forms.Button();
            this.button4 = new System.Windows.Forms.Button();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
            this.SuspendLayout();
            // 
            // barcodePDF4171
            // 
            this.barcodePDF4171.BackColor = System.Drawing.Color.White;
            this.barcodePDF4171.ForeColor = System.Drawing.Color.Black;
            this.barcodePDF4171.Location = new System.Drawing.Point(32, 12);
            this.barcodePDF4171.Name = "barcodePDF4171";
            this.barcodePDF4171.PDFColumns = ((short)(13));
            this.barcodePDF4171.PDFRows = ((short)(30));
            this.barcodePDF4171.Size = new System.Drawing.Size(340, 113);
            this.barcodePDF4171.TabIndex = 0;
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(428, 160);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(80, 32);
            this.button1.TabIndex = 1;
            this.button1.Text = "Save As";
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // button3
            // 
            this.button3.Location = new System.Drawing.Point(428, 200);
            this.button3.Name = "button3";
            this.button3.Size = new System.Drawing.Size(80, 32);
            this.button3.TabIndex = 3;
            this.button3.Text = "Update Data";
            this.button3.Click += new System.EventHandler(this.button3_Click);
            // 
            // button4
            // 
            this.button4.Location = new System.Drawing.Point(428, 240);
            this.button4.Name = "button4";
            this.button4.Size = new System.Drawing.Size(80, 32);
            this.button4.TabIndex = 4;
            this.button4.Text = "Exit";
            this.button4.Click += new System.EventHandler(this.button4_Click);
            // 
            // textBox1
            // 
            this.textBox1.Location = new System.Drawing.Point(16, 136);
            this.textBox1.Multiline = true;
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(400, 164);
            this.textBox1.TabIndex = 5;
            this.textBox1.Text = "Type the information here";
            // 
            // saveFileDialog1
            // 
            this.saveFileDialog1.Filter = "BMP|*.bmp |GIF|*.gif|JPEG|*.jpeg *.jpg|PNG|*.png";
            // 
            // Form1
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(520, 313);
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.button4);
            this.Controls.Add(this.button3);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.barcodePDF4171);
            this.Name = "Form1";
            this.Text = "Form1";
            this.ResumeLayout(false);

        }
		#endregion

		/// <summary>
		/// Punto de entrada principal de la aplicaci髇.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

        private void button4_Click(object sender, System.EventArgs e) {
            this.Close();
        }

        private void button3_Click(object sender, System.EventArgs e) {
            barcodePDF4171.Data = textBox1.Text;
            barcodePDF4171.Refresh();
        }

        private void button1_Click(object sender, System.EventArgs e) {
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                switch (saveFileDialog1.FilterIndex)
                {
                    case 1:
                    {
                        barcodePDF4171.SaveAsImage(saveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Bmp);
                        break;
                    }
                    case 2:
                    {
                        barcodePDF4171.SaveAsImage(saveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Gif);
                        break;
                    }
                    case 3:
                    {
                        barcodePDF4171.SaveAsImage(saveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Jpeg);
                        break;
                    }
                    case 4:
                    {
                        barcodePDF4171.SaveAsImage(saveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Png);
                        break;
                    }
                }
            }
        }
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -