您的位置: 条形码技术网>条码软件>文章内容

C#打印条型码生成源程序

上篇:在水晶报表中显示条形码
下篇:Aspose.BarCode for Java 1.0.0.0发布啦

第一次在这里写东西,是想在这里认识更多的朋友,能与高手们交流,呵呵。。这个程序是早此时候要用到条形码时到处找资料,受别人启发,自己尝试开发的简单测试程序,希望对有需要的朋友有所帮助,其实本人也算是C#的初学者,最近刚用它为公司开发了一个数据库应用程序.呵呵..题外话就不多说了.下面就将代码贴出来,自己看去吧.谢谢大家,谢多多支持

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;
namespace barcode
{
 /// <summary>
 /// Form1 的摘要说明。
 /// </summary>
 public class Form1 : System.Windows.Forms.Form
 {
  Bitmap memoryImage ; 
  [DllImport("gdi32.dll")]
  public static extern long  BitBlt(IntPtr hdcDest, int NXDestt,int nYDest,int nWidth,int nHeight,IntPtr hdcSrc,int nXSrc,int nYSrc,System.Int32 dwRop);
  private System.Windows.Forms.LinkLabel linkLabel1;
  private System.Windows.Forms.GroupBox setbarcode;
  private System.Windows.Forms.TextBox barcodewide;
  private System.Windows.Forms.TextBox barcodeleng;
  private System.Windows.Forms.Label label8;
  private System.Windows.Forms.Label label7;
  private System.Windows.Forms.ComboBox to;
  private System.Windows.Forms.ComboBox line;
  private System.Windows.Forms.Label label5;
  private System.Windows.Forms.Label label4;
  private System.Windows.Forms.ComboBox stand2;
  private System.Windows.Forms.Label label3;
  private System.Windows.Forms.ComboBox stand;
  private System.Windows.Forms.Label label1;
  private System.Windows.Forms.GroupBox groupBox2;
  private System.Windows.Forms.SaveFileDialog saveFileDialog1;
  private System.Drawing.Printing.PrintDocument printDocument1;
  private System.Windows.Forms.Label label2;
  private System.Windows.Forms.TextBox textBox1;
  private System.Windows.Forms.Button savebarcode;
  private System.Windows.Forms.Button printbarcode;
  private AxBARCODELib.AxBarCodeCtrl BarCode1;
  /// <summary>
  /// 必需的设计器变量。
  /// </summary>
  private System.ComponentModel.Container components = null;

  public Form1()
  {
   //
   // Windows 窗体设计器支持所必需的
   //
   InitializeComponent();

   //
   // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
   //
  }

  /// <summary>
  /// 清理所有正在使用的资源。
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if (components != null)
    {
     components.Dispose();
    }
   }
   base.Dispose( disposing );
  }

  #region Windows 窗体设计器生成的代码
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {
   System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
   this.linkLabel1 = new System.Windows.Forms.LinkLabel();
   this.setbarcode = new System.Windows.Forms.GroupBox();
   this.barcodewide = new System.Windows.Forms.TextBox();
   this.barcodeleng = new System.Windows.Forms.TextBox();
   this.label8 = new System.Windows.Forms.Label();
   this.label7 = new System.Windows.Forms.Label();
   this.to = new System.Windows.Forms.ComboBox();
   this.line = new System.Windows.Forms.ComboBox();
   this.label5 = new System.Windows.Forms.Label();
   this.label4 = new System.Windows.Forms.Label();
   this.stand2 = new System.Windows.Forms.ComboBox();
   this.label3 = new System.Windows.Forms.Label();
   this.stand = new System.Windows.Forms.ComboBox();
   this.label1 = new System.Windows.Forms.Label();
   this.groupBox2 = new System.Windows.Forms.GroupBox();
   this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
   this.printDocument1 = new System.Drawing.Printing.PrintDocument();
   this.label2 = new System.Windows.Forms.Label();
   this.textBox1 = new System.Windows.Forms.TextBox();
   this.savebarcode = new System.Windows.Forms.Button();
   this.printbarcode = new System.Windows.Forms.Button();
   this.BarCode1 = new AxBARCODELib.AxBarCodeCtrl();
   this.setbarcode.SuspendLayout();
   ((System.ComponentModel.ISupportInitialize)(this.BarCode1)).BeginInit();
   this.SuspendLayout();
   //
   // linkLabel1
   //
   this.linkLabel1.LinkArea = new System.Windows.Forms.LinkArea(8, 16);
   this.linkLabel1.Location = new System.Drawing.Point(24, 280);
   this.linkLabel1.Name = "linkLabel1";
   this.linkLabel1.Size = new System.Drawing.Size(252, 27);
   this.linkLabel1.TabIndex = 26;
   this.linkLabel1.TabStop = true;
   this.linkLabel1.Text = "程序设计:陈凌 Fireling@126.com";
   //
   // setbarcode
   //
   this.setbarcode.Controls.Add(this.barcodewide);
   this.setbarcode.Controls.Add(this.barcodeleng);
   this.setbarcode.Controls.Add(this.label8);
   this.setbarcode.Controls.Add(this.label7);
   this.setbarcode.Controls.Add(this.to);
   this.setbarcode.Controls.Add(this.line);
   this.setbarcode.Controls.Add(this.label5);
   this.setbarcode.Controls.Add(this.label4);
   this.setbarcode.Controls.Add(this.stand2);
   this.setbarcode.Controls.Add(this.label3);
   this.setbarcode.Controls.Add(this.stand);
   this.setbarcode.Controls.Add(this.label1);
   this.setbarcode.Location = new System.Drawing.Point(249, 8);
   this.setbarcode.Name = "setbarcode";
   this.setbarcode.Size = new System.Drawing.Size(272, 224);
   this.setbarcode.TabIndex = 25;
   this.setbarcode.TabStop = false;
   this.setbarcode.Text = "设置条形码";
   //
   // barcodewide
   //
   this.barcodewide.Location = new System.Drawing.Point(168, 176);
   this.barcodewide.Name = "barcodewide";
   this.barcodewide.Size = new System.Drawing.Size(74, 21);
   this.barcodewide.TabIndex = 18;
   this.barcodewide.Text = "";
   this.barcodewide.TextChanged += new System.EventHandler(this.barcodewide_TextChanged);
   //
   // barcodeleng
   //
   this.barcodeleng.Location = new System.Drawing.Point(80, 176);
   this.barcodeleng.Name = "barcodeleng";
   this.barcodeleng.Size = new System.Drawing.Size(56, 21);
   this.barcodeleng.TabIndex = 17;
   this.barcodeleng.Text = "";
   this.barcodeleng.TextChanged += new System.EventHandler(this.barcodeleng_TextChanged);
   //
   // label8
   //
   this.label8.AutoSize = true;
   this.label8.Location = new System.Drawing.Point(144, 176);
   this.label8.Name = "label8";
   this.label8.Size = new System.Drawing.Size(11, 17);
   this.label8.TabIndex = 16;
   this.label8.Text = "X";
   //
   // label7
   //
   this.label7.AutoSize = true;
   this.label7.Location = new System.Drawing.Point(24, 176);
   this.label7.Name = "label7";
   this.label7.Size = new System.Drawing.Size(35, 17);
   this.label7.TabIndex = 15;
   this.label7.Text = "长度:";
   //
   // to
   //
   this.to.Location = new System.Drawing.Point(112, 136);
   this.to.Name = "to";
   this.to.Size = new System.Drawing.Size(141, 20);
   this.to.TabIndex = 14;
   this.to.SelectedIndexChanged += new System.EventHandler(this.to_SelectedIndexChanged);
   //
   // line
   //
   this.line.Location = new System.Drawing.Point(112, 104);
   this.line.Name = "line";
   this.line.Size = new System.Drawing.Size(141, 20);
   this.line.TabIndex = 13;
   this.line.SelectedIndexChanged += new System.EventHandler(this.line_SelectedIndexChanged);
   //
   // label5
   //
   this.label5.AutoSize = true;
   this.label5.Location = new System.Drawing.Point(24, 136);
   this.label5.Name = "label5";
   this.label5.Size = new System.Drawing.Size(35, 17);
   this.label5.TabIndex = 12;
   this.label5.Text = "方向:";

共3页: 上一页 1 [2] [3] 下一页

相关文章

·在水晶报表中显示条形码
·Aspose.BarCode for Java 1.0.0.0发布啦
·中国最全的barcode条码开发资料!
·使用 Java 读取条形码和维护库存数据库
·Barbecue - Java Barcode
·用Asp生成条形码
·从图片中取出barocode
·搜易条码专家[BarExpert] 3.5(含注册机)


Copyright (C) 2006 - 2008 条码技术网 网站地图 | RSS订阅 | 高级搜索