نمایش نتایج 1 تا 3 از 3

نام تاپیک: تولید QR_Code در win form

  1. #1
    کاربر دائمی آواتار پرستو پارسایی
    تاریخ عضویت
    آبان 1392
    محل زندگی
    تهران
    پست
    212

    تولید QR_Code در win form

    با سلام روش صحیح تولید Qr_Code در ویندوز فرم چه مراحلی داره ؟
    برای بارکد از این نمونه استفاده کردم و فکر میکنم برای QR_Code نیاز به DLL استانداردی هست . ممنون میشم دوستان در صورت اطلاع پاسخ دهید

    Imports SystemImports System.IO
    Imports System.Drawing
    Imports System.Drawing.Printing
    Imports System.Windows.Forms




    Public Class Form1


    Dim BINARY As String
    Dim CheckSumVal As Integer
    Dim BINVAL As String
    Dim BINARYLength As Int32
    Friend WithEvents printDoc As New PrintDocument()
    Dim bmpBarcode As Bitmap




    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    picBarcode.BackColor = Color.White
    Dim FontSize As Integer = 0
    Dim LengthOfBarcode As Integer = 10
    FontSize = 1
    Do Until FontSize = 72
    cboSize.Items.Add(FontSize)
    FontSize = FontSize + 1
    Loop
    Do Until LengthOfBarcode = 110
    cboLength.Items.Add(LengthOfBarcode)
    LengthOfBarcode = LengthOfBarcode + 10
    Loop
    cboSize.SelectedIndex = 0
    cboLength.SelectedIndex = 9
    End Sub


    Private Sub btnGenerate_Click(sender As Object, e As EventArgs) Handles btnGenerate.Click
    GenerateBINARY(txtInput.Text)
    GenerateBarcode(BINARY)
    End Sub


    Private Sub GenerateBINARY(Input As String)
    BINARY = 0
    Dim CharVal As Integer = 0
    Dim CharCount As Integer = 0
    Dim GrandCharCount As Integer = 0
    Dim CheckSum As Integer = 0
    For Each Item As Char In Input
    Select Case Item
    Case Is = " "
    BINARY = BINARY & "11011001100"
    CharVal = 0
    Case Is = "!"
    BINARY = BINARY & "11001101100"
    CharVal = 1
    Case Is = """"
    BINARY = BINARY & "11001100110"
    CharVal = 2
    Case Is = "#"
    BINARY = BINARY & "10010011000"
    CharVal = 3
    Case Is = "$"
    BINARY = BINARY & "10010001100"
    CharVal = 4
    Case "%"
    BINARY = BINARY & "10001001100"
    CharVal = 5
    Case "&"
    BINARY = BINARY & "10011001000"
    CharVal = 6
    Case "'"
    BINARY = BINARY & "10011000100"
    CharVal = 7
    Case "("
    BINARY = BINARY & "10001100100"
    CharVal = 8
    Case ")"
    BINARY = BINARY & "11001001000"
    CharVal = 9
    Case "*"
    BINARY = BINARY & "11001000100"
    CharVal = 10
    Case "+"
    BINARY = BINARY & "11000100100"
    CharVal = 11
    Case ","
    BINARY = BINARY & "10110011100"
    CharVal = 12
    Case "-"
    BINARY = BINARY & "10011011100"
    CharVal = 13
    Case "."
    BINARY = BINARY & "10011001110"
    CharVal = 14
    Case "/"
    BINARY = BINARY & "10111001100"
    CharVal = 15
    Case "0"
    BINARY = BINARY & "10011101100"
    CharVal = 16
    Case "1"
    BINARY = BINARY & "10011100110"
    CharVal = 17
    Case "2"
    BINARY = BINARY & "11001110010"
    CharVal = 18
    Case "3"
    BINARY = BINARY & "11001011100"
    CharVal = 19
    Case "4"
    BINARY = BINARY & "11001001110"
    CharVal = 20
    Case "5"
    BINARY = BINARY & "11011100100"
    CharVal = 21
    Case "6"
    BINARY = BINARY & "11001110100"
    CharVal = 22
    Case "7"
    BINARY = BINARY & "11101101110"
    CharVal = 23
    Case "8"
    BINARY = BINARY & "11101001100"
    CharVal = 24
    Case "9"
    BINARY = BINARY & "11100101100"
    CharVal = 25
    Case ":"
    BINARY = BINARY & "11100100110"
    CharVal = 26
    Case " ;"
    BINARY = BINARY & "11101100100"
    CharVal = 27
    Case "<"
    BINARY = BINARY & "11100110100"
    CharVal = 28
    Case "="
    BINARY = BINARY & "11100110010"
    CharVal = 29
    Case ">"
    BINARY = BINARY & "11011011000"
    CharVal = 30
    Case " ?"
    BINARY = BINARY & "11011000110"
    CharVal = 31
    Case "@"
    BINARY = BINARY & "11000110110"
    CharVal = 32
    Case "A"
    BINARY = BINARY & "10100011000"
    CharVal = 33
    Case "B"
    BINARY = BINARY & "10001011000"
    CharVal = 34
    Case "C"
    BINARY = BINARY & "10001000110"
    CharVal = 35
    Case "D"
    BINARY = BINARY & "10110001000"
    CharVal = 36
    Case "E"
    BINARY = BINARY & "10001101000"
    CharVal = 37
    Case "F"
    BINARY = BINARY & "10001100010"
    CharVal = 38
    Case "G"
    BINARY = BINARY & "11010001000"
    CharVal = 39
    Case "H"
    BINARY = BINARY & "11000101000"
    CharVal = 40
    Case "I"
    BINARY = BINARY & "11000100010"
    CharVal = 41
    Case "J"
    BINARY = BINARY & "10110111000"
    CharVal = 42
    Case "K"
    BINARY = BINARY & "10110001110"
    CharVal = 43
    Case "L"
    BINARY = BINARY & "10001101110"
    CharVal = 44
    Case "M"
    BINARY = BINARY & "10111011000"
    CharVal = 45
    Case "N"
    BINARY = BINARY & "10111000110"
    CharVal = 46
    Case "O"
    BINARY = BINARY & "10001110110"
    CharVal = 47
    Case "P"
    BINARY = BINARY & "11101110110"
    CharVal = 48
    Case "Q"
    BINARY = BINARY & "11010001110"
    CharVal = 49
    Case "R"
    BINARY = BINARY & "11000101110"
    CharVal = 50
    Case "S"
    BINARY = BINARY & "11011101000"
    CharVal = 51
    Case "T"
    BINARY = BINARY & "11011100010"
    CharVal = 52
    Case "U"
    BINARY = BINARY & "11011101110"
    CharVal = 53
    Case "V"
    BINARY = BINARY & "11101011000"
    CharVal = 54
    Case "W"
    BINARY = BINARY & "11101000110"
    CharVal = 55
    Case "X"
    BINARY = BINARY & "11100010110"
    CharVal = 56
    Case "Y"
    BINARY = BINARY & "11101101000"
    CharVal = 57
    Case "Z"
    BINARY = BINARY & "11101100010"
    CharVal = 58
    Case "["
    BINARY = BINARY & "11100011010"
    CharVal = 59
    Case ""
    BINARY = BINARY & "11101111010"
    CharVal = 60
    Case "]"
    BINARY = BINARY & "11001000010"
    CharVal = 61
    Case "^"
    BINARY = BINARY & "11110001010"
    CharVal = 62
    Case "_"
    BINARY = BINARY & "10100110000"
    CharVal = 63
    Case "`"
    BINARY = BINARY & "10100001100"
    CharVal = 64
    Case "a"
    BINARY = BINARY & "10010110000"
    CharVal = 65
    Case "b"
    BINARY = BINARY & "10010000110"
    CharVal = 66
    Case "c"
    BINARY = BINARY & "10000101100"
    CharVal = 67
    Case "d"
    BINARY = BINARY & "10000100110"
    CharVal = 68
    Case "e"
    BINARY = BINARY & "10110010000"
    CharVal = 69
    Case "f"
    BINARY = BINARY & "10110000100"
    CharVal = 70
    Case "g"
    BINARY = BINARY & "10011010000"
    CharVal = 71
    Case "h"
    BINARY = BINARY & "10011000010"
    CharVal = 72
    Case "i"
    BINARY = BINARY & "10000110100"
    CharVal = 73
    Case "j"
    BINARY = BINARY & "10000110010"
    CharVal = 74
    Case "k"
    BINARY = BINARY & "11000010010"
    CharVal = 75
    Case "l"
    BINARY = BINARY & "11001010000"
    CharVal = 76
    Case "m"
    BINARY = BINARY & "11110111010"
    CharVal = 77
    Case "n"
    BINARY = BINARY & "11000010100"
    CharVal = 78
    Case "o"
    BINARY = BINARY & "10001111010"
    CharVal = 79
    Case "p"
    BINARY = BINARY & "10100111100"
    CharVal = 80
    Case "q"
    BINARY = BINARY & "10010111100"
    CharVal = 81
    Case "r"
    BINARY = BINARY & "10010011110"
    CharVal = 82
    Case "s"
    BINARY = BINARY & "10111100100"
    CharVal = 83
    Case "t"
    BINARY = BINARY & "10011110100"
    CharVal = 84
    Case "u"
    BINARY = BINARY & "10011110010"
    CharVal = 85
    Case "v"
    BINARY = BINARY & "11110100100"
    CharVal = 86
    Case "w"
    BINARY = BINARY & "11110010100"
    CharVal = 87
    Case "x"
    BINARY = BINARY & "11110010010"
    CharVal = 88
    Case "y"
    BINARY = BINARY & "11011011110"
    CharVal = 89
    Case "z"
    BINARY = BINARY & "11011110110"
    CharVal = 90
    Case "{"
    BINARY = BINARY & "11110110110"
    CharVal = 91
    Case "|"
    BINARY = BINARY & "10101111000"
    CharVal = 92
    Case "}"
    BINARY = BINARY & "10100011110"
    CharVal = 93
    Case "~"
    BINARY = BINARY & "10001011110"
    CharVal = 94
    End Select
    CharCount = CharCount + 1
    GrandCharCount = CharVal * CharCount
    CheckSum = CheckSum + GrandCharCount


    Next


    'Include start code B
    CheckSum = CheckSum + 104
    'Get the remander
    CheckSumVal = CheckSum Mod 103


    'Set it to zero before we generate it
    BINVAL = 0
    GenerateCheckSum(CheckSumVal)


    'Start
    BINARY = "00011010010000" & BINARY
    'End
    BINARY = BINARY & BINVAL & "1100011101011000"
    '


    BINARYLength = 0
    For Each dig As String In BINARY
    CharCount = CharCount + 1
    Next




    End Sub


    Private Sub GenerateCheckSum(Dig As Integer)




    Select Case Dig
    Case "0"
    BINVAL = "11011001100"
    Case "1"
    BINVAL = "11001101100"
    Case "2"
    BINVAL = "11001100110"
    Case "3"
    BINVAL = "10010011000"
    Case "4"
    BINVAL = "10010001100"
    Case "5"
    BINVAL = "10001001100"
    Case "6"
    BINVAL = "10011001000"
    Case "7"
    BINVAL = "10011000100"
    Case "8"
    BINVAL = "10001100100"
    Case "9"
    BINVAL = "11001001000"
    Case "10"
    BINVAL = "11001000100"
    Case "11"
    BINVAL = "11000100100"
    Case "12"
    BINVAL = "10110011100"
    Case "13"
    BINVAL = "10011011100"
    Case "14"
    BINVAL = "10011001110"
    Case "15"
    BINVAL = "10111001100"
    Case "16"
    BINVAL = "10011101100"
    Case "17"
    BINVAL = "10011100110"
    Case "18"
    BINVAL = "11001110010"
    Case "19"
    BINVAL = "11001011100"
    Case "20"
    BINVAL = "11001001110"
    Case "21"
    BINVAL = "11011100100"
    Case "22"
    BINVAL = "11001110100"
    Case "23"
    BINVAL = "11101101110"
    Case "24"
    BINVAL = "11101001100"
    Case "25"
    BINVAL = "11100101100"
    Case "26"
    BINVAL = "11100100110"
    Case "27"
    BINVAL = "11101100100"
    Case "28"
    BINVAL = "11100110100"
    Case "29"
    BINVAL = "11100110010"
    Case "30"
    BINVAL = "11011011000"
    Case "31"
    BINVAL = "11011000110"
    Case "32"
    BINVAL = "11000110110"
    Case "33"
    BINVAL = "10100011000"
    Case "34"
    BINVAL = "10001011000"
    Case "35"
    BINVAL = "10001000110"
    Case "36"
    BINVAL = "10110001000"
    Case "37"
    BINVAL = "10001101000"
    Case "38"
    BINVAL = "10001100010"
    Case "39"
    BINVAL = "11010001000"
    Case "40"
    BINVAL = "11000101000"
    Case "41"
    BINVAL = "11000100010"
    Case "42"
    BINVAL = "10110111000"
    Case "43"
    BINVAL = "10110001110"
    Case "44"
    BINVAL = "10001101110"
    Case "45"
    BINVAL = "10111011000"
    Case "46"
    BINVAL = "10111000110"
    Case "47"
    BINVAL = "10001110110"
    Case "48"
    BINVAL = "11101110110"
    Case "49"
    BINVAL = "11010001110"
    Case "50"
    BINVAL = "11000101110"
    Case "51"
    BINVAL = "11011101000"
    Case "52"
    BINVAL = "11011100010"
    Case "53"
    BINVAL = "11011101110"
    Case "54"
    BINVAL = "11101011000"
    Case "55"
    BINVAL = "11101000110"
    Case "56"
    BINVAL = "11100010110"
    Case "57"
    BINVAL = "11101101000"
    Case "58"
    BINVAL = "11101100010"
    Case "59"
    BINVAL = "11100011010"
    Case "60"
    BINVAL = "11101111010"
    Case "61"
    BINVAL = "11001000010"
    Case "62"
    BINVAL = "11110001010"
    Case "63"
    BINVAL = "10100110000"
    Case "64"
    BINVAL = "10100001100"
    Case "65"
    BINVAL = "10010110000"
    Case "66"
    BINVAL = "10010000110"
    Case "67"
    BINVAL = "10000101100"
    Case "68"
    BINVAL = "10000100110"
    Case "69"
    BINVAL = "10110010000"
    Case "70"
    BINVAL = "10110000100"
    Case "71"
    BINVAL = "10011010000"
    Case "72"
    BINVAL = "10011000010"
    Case "73"
    BINVAL = "10000110100"
    Case "74"
    BINVAL = "10000110010"
    Case "75"
    BINVAL = "11000010010"
    Case "76"
    BINVAL = "11001010000"
    Case "77"
    BINVAL = "11110111010"
    Case "78"
    BINVAL = "11000010100"
    Case "79"
    BINVAL = "10001111010"
    Case "80"
    BINVAL = "10100111100"
    Case "81"
    BINVAL = "10010111100"
    Case "82"
    BINVAL = "10010011110"
    Case "83"
    BINVAL = "10111100100"
    Case "84"
    BINVAL = "10011110100"
    Case "85"
    BINVAL = "10011110010"
    Case "86"
    BINVAL = "11110100100"
    Case "87"
    BINVAL = "11110010100"
    Case "88"
    BINVAL = "11110010010"
    Case "89"
    BINVAL = "11011011110"
    Case "90"
    BINVAL = "11011110110"
    Case "91"
    BINVAL = "11110110110"
    Case "92"
    BINVAL = "10101111000"
    Case "93"
    BINVAL = "10100011110"
    Case "94"
    BINVAL = "10001011110"


    End Select






    End Sub




    Private Sub GenerateBarcode(Input As String)
    Dim num As Integer = 0
    For Each one As String In Input
    num = num + cboSize.Text
    Next
    Dim rec As New Rectangle(1, 1, num, cboLength.Text)
    Dim img As New Bitmap(num, Convert.ToInt32(cboLength.Text))
    Dim count As Integer = 0
    Dim length As Integer = 0
    Dim aBlackPen As New Pen(Color.Black)
    Dim aWhitePen As New Pen(Color.White)
    aBlackPen.Width = cboSize.Text
    aWhitePen.Width = cboSize.Text
    length = length + cboLength.Text
    For Each item As String In Input
    count = count + cboSize.Text
    If item = 1 Then
    picBarcode.CreateGraphics.DrawLine(aBlackPen, count, 1, count, length)
    Else
    picBarcode.CreateGraphics.DrawLine(aWhitePen, count, 1, count, length)
    End If


    Next
    picBarcode.DrawToBitmap(img, rec)
    bmpBarcode = img


    End Sub


    Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
    picBarcode.Image = Nothing
    End Sub


    Private Sub PrintImage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles printDoc.PrintPage
    e.Graphics.DrawImage(bmpBarcode, e.MarginBounds.Left, e.MarginBounds.Top)
    End Sub


    Private Sub btnPrint_Click(sender As Object, e As EventArgs) Handles btnPrint.Click
    printDoc.Print()
    End Sub
    End Class



  2. #2

    نقل قول: تولید QR_Code در win form

    نقل قول نوشته شده توسط پرستو پارسایی مشاهده تاپیک
    با سلام روش صحیح تولید Qr_Code در ویندوز فرم چه مراحلی داره ؟
    برای بارکد از این نمونه استفاده کردم و فکر میکنم برای QR_Code نیاز به DLL استانداردی هست . ممنون میشم دوستان در صورت اطلاع پاسخ دهید
    شخصا از ZXing.Net استفاده می کنم که انواع بارکد ها (QR Code, PDF 417, EAN, UPC, Aztec, Data Matrix, Codabar و ...) رو هم ایجاد می کنه و هم میتونه بارکد روی تصاویر رو شناسایی کنه و بخونه.
    نحوه اضافه کردن Package به پروژه رو هم که لابد می دونید، دسترسی به اینترنت فراهم باشه، در منوی Project گزینه ...Manage NuGet Packages
    (یا در منوی Tools گزینه ...NuGet Package Manager > Manage NuGet Packages for Solution)
    کلیک روی بخش Browse، نوشتن اسم Package در کادر Search (مثلا عبارت ZXing.Net) و کلیک روی Package مورد نظر در نتایج جستجو و زدن تیک پروژه و کلیک روی دکمه Install و تمام.
    وقتی پروژه رو Build کنید dll های مورد استفاده اون Package کنار فایل اجرایی برنامه تون کپی میشه.

  3. #3
    کاربر دائمی آواتار پرستو پارسایی
    تاریخ عضویت
    آبان 1392
    محل زندگی
    تهران
    پست
    212

    نقل قول: تولید QR_Code در win form

    کامل و آموزنده . سپاسگزارم

تاپیک های مشابه

  1. سوال: ابزاری برای تولید asp.net form generator
    نوشته شده توسط بیتا حکمت در بخش ASP.NET Web Forms
    پاسخ: 0
    آخرین پست: دوشنبه 22 دی 1393, 15:16 عصر
  2. سوال: چجوری می تونم از اطلاعات یک web form در یک web form دیگه استفاده کنم
    نوشته شده توسط mustafaehsani در بخش ASP.NET Web Forms
    پاسخ: 1
    آخرین پست: دوشنبه 02 اردیبهشت 1392, 12:16 عصر

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •