C# Basit Barcode okuma Programı

10 yorum
Merhaba Arkadaşlar ,

Bu bölümde basit şekilde bir barcode okuma programı yazıyor olacağız.projeyi indire bilmeniz ve kaynak kodlarına erişebilmeniz için aşağıdaki linklere tıklayarak projede kullanılan ddl dosyası ve fontları ayrıca proje source tarafını elde edebilirsiniz.Bu aşamada son olarak açacağınız proje üzerine gelip properties diyerek den  freamwork 4 e çekmeniz ve indirmiş olduğunuz font ve dll li proje referans edip eklemniz yeterli olacaktır.



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
 
namespace BarcodeSamples
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        private void btnCreateCode_Click(object sender, EventArgs e)
        {
            BarcodeLib.Barcode b = new BarcodeLib.Barcode();
 
            int genislik = Convert.ToInt32(txtWidth.Text);
            int yukseklik = Convert.ToInt32(txtHeight.Text);
            b.Alignment = BarcodeLib.AlignmentPositions.CENTER;
 
            BarcodeLib.TYPE type = BarcodeLib.TYPE.UNSPECIFIED;
            switch (cmbBarcodeTypes.SelectedItem.ToString())
            {
                case "UPC-A":
                    type = BarcodeLib.TYPE.UPCA;
                    break;
 
                case "UPC-E":
                    type = BarcodeLib.TYPE.UPCE;
                    break;
 
                case "UPC 2 Digit Ext.":
                    type = BarcodeLib.TYPE.UPC_SUPPLEMENTAL_2DIGIT;
 
                    break;
                case "UPC 5 Digit Ext.":
                    type = BarcodeLib.TYPE.UPC_SUPPLEMENTAL_5DIGIT;
 
                    break;
                case "EAN-13":
                    type = BarcodeLib.TYPE.EAN13;
 
                    break;
                case "JAN-13":
                    type = BarcodeLib.TYPE.JAN13;
 
                    break;
                case "EAN-8":
                    type = BarcodeLib.TYPE.EAN8;
 
                    break;
                case "ITF-14":
                    type = BarcodeLib.TYPE.ITF14;
 
                    break;
                case "Codabar":
                    type = BarcodeLib.TYPE.Codabar;
 
                    break;
                case "PostNet":
                    type = BarcodeLib.TYPE.PostNet;
 
                    break;
                case "Bookland/ISBN":
                    type = BarcodeLib.TYPE.BOOKLAND;
 
                    break;
                case "Code 11":
                    type = BarcodeLib.TYPE.CODE11;
 
                    break;
                case "Code 39":
                    type = BarcodeLib.TYPE.CODE39;
 
                    break;
                case "Code 39 Extended":
                    type = BarcodeLib.TYPE.CODE39Extended;
 
                    break;
                case "Code 93":
                    type = BarcodeLib.TYPE.CODE93;
 
                    break;
                case "LOGMARS":
                    type = BarcodeLib.TYPE.LOGMARS;
 
                    break;
                case "MSI":
                    type = BarcodeLib.TYPE.MSI_Mod10;
 
                    break;
                case "Interleaved 2 of 5":
                    type = BarcodeLib.TYPE.Interleaved2of5;
 
                    break;
                case "Standard 2 of 5":
                    type = BarcodeLib.TYPE.Standard2of5;
 
                    break;
                case "Code 128":
                    type = BarcodeLib.TYPE.CODE128;
 
                    break;
                case "Code 128-A":
                    type = BarcodeLib.TYPE.CODE128A;
 
                    break;
                case "Code 128-B":
                    type = BarcodeLib.TYPE.CODE128B;
 
                    break;
                case "Code 128-C":
                    type = BarcodeLib.TYPE.CODE128C;
 
                    break;
                case "Telepen":
                    type = BarcodeLib.TYPE.TELEPEN;
 
                    break;
                case "FIM":
                    type = BarcodeLib.TYPE.FIM;
 
                    break;
                default:
                    MessageBox.Show("Barkod türü belirtin !");
                    break;
            }
            try
            {
                if (type != BarcodeLib.TYPE.UNSPECIFIED)
                {
                    pcBarcode.Image = b.Encode(type, txtInsertCode.Text, genislik, yukseklik);
                }
 
                pcBarcode.Width = pcBarcode.Image.Width;
                pcBarcode.Height = pcBarcode.Image.Height;
 
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}

Proje Dosyası indir
Dll indir
Font indir

10 yorum :

  1. merhabalar. barkod kodunu telefonla okuyup textboxa otomatik girebilir miyiz?

    YanıtlaSil
  2. helal olsun abi kütür kütür çalışıyor kodlar kaç saattir uğraşıyorum kaç site gezdim olmadı sonunda senin kodları yazdım çalıştı ellerine sağlık

    YanıtlaSil
  3. Çok teşekkürler,Barkod okuma programıyla uğraşacağımda bu işime yarayabilir <3

    YanıtlaSil
  4. aynı programı karekod olarak yapmak için ne yapmam gerekli teşekkür ederim.

    YanıtlaSil
  5. çok güzel bir örnek bu barkodu word tablosunun herhngi bir hücresinde nasıl gösterebilirz..

    YanıtlaSil
    Yanıtlar
    1. Merhaba Levent Aşkun blogda excelle aktarılan tablo örneğini incelerseniz size yardımcı olacaktır

      Sil
  6. Merhaba hocam.Bu şekilde oluşturulan barkod u okuttuğumuz zaman istenilen bilgileri bize vermesi için ne yapabiliriz.

    YanıtlaSil
  7. abi barkod dediğin altında sayılar yazmazmıki

    YanıtlaSil
  8. Merhaba Eren yazar tabi yazdırmak istersen

    YanıtlaSil
  9. Oluşturdugumuz barkodları tek bir listede birleştirip o ürünün kodunu yazınca ekrana nasıl getirebilrim?

    YanıtlaSil

Soru Görüş önerileriniz için gmail plus üzerinden + layın müsait olduğumda mutlaka yanıt dönüyor olacağım.