基本信息
源码名称:UPCA条形码
源码大小:0.07M
文件格式:.rar
开发语言:C#
更新时间:2016-11-21
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 20 元 
   源码介绍


partial class frmUPCA : Form
    {
        private UpcA upc = null;

        public frmUPCA( )
        {
            InitializeComponent( );
            cboProductType.SelectedIndex = 0;
            cboScale.SelectedIndex = 2;
        }

        private void CreateUPC( )
        {
            upc = new UpcA( );
            upc.ProductType = cboProductType.Items [cboProductType.SelectedIndex].ToString( );
            upc.ManufacturerCode = txtManufacturerCode.Text;
            upc.ProductCode = txtProductCode.Text;
            if( txtChecksumDigit.Text.Length > 0 )
                upc.ChecksumDigit = txtChecksumDigit.Text;
        }

        private void butDraw_Click(object sender, EventArgs e)
        {
            System.Drawing.Graphics g = this.picBarcode.CreateGraphics( );
            
            g.FillRectangle( new System.Drawing.SolidBrush( System.Drawing.SystemColors.Control ),
                             new Rectangle( 0, 0, picBarcode.Width, picBarcode.Height ) );

            CreateUPC( );
            upc.Scale = (float)Convert.ToDecimal( cboScale.Items [cboScale.SelectedIndex] );
            upc.DrawUpcaBarcode( g, new System.Drawing.Point( 0, 0 ) );
            txtChecksumDigit.Text = upc.ChecksumDigit;
            g.Dispose( );
        }

        private void butPrint_Click(object sender, EventArgs e)
        {
            System.Drawing.Printing.PrintDocument pd = new System.Drawing.Printing.PrintDocument( );
            pd.PrintPage = new System.Drawing.Printing.PrintPageEventHandler( this.pd_PrintPage );
            pd.Print( );
        }

        private void pd_PrintPage( object sender, System.Drawing.Printing.PrintPageEventArgs ev )
        {
            CreateUPC( );
            upc.Scale = ( float )Convert.ToDecimal( cboScale.Items [cboScale.SelectedIndex] );
            upc.DrawUpcaBarcode( ev.Graphics, new System.Drawing.Point( 0, 0 ) );
            txtChecksumDigit.Text = upc.ChecksumDigit;

            // Add Code here to print other information.
            ev.Graphics.Dispose( );
        }

        private void butCreateBitmap_Click(object sender, EventArgs e)
        {
            CreateUPC( );
            upc.Scale = ( float )Convert.ToDecimal( cboScale.Items [cboScale.SelectedIndex] );

            System.Drawing.Bitmap bmp = upc.CreateBitmap( );
            this.picBarcode.Image = bmp;
        }
    }