第一次在这里写东西,是想在这里认识更多的朋友,能与高手们交流,呵呵。。这个程序是早此时候要用到条形码时到处找资料,受别人启发,自己尝试开发的简单测试程序,希望对有需要的朋友有所帮助,其实本人也算是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()