Barcode 3 of 9 generator
Create a 3 of 9 bar code without using a TTF, DLL or OCX.
AI
Yapay Zeka Özeti: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Kaynak Kod
Public Sub Code3of9(sToCode As String, pPaintInto As PictureBox, pLabelInto As Label) Dim sValidChars As String Dim sValidCodes As String Dim lElevate As Integer Dim lCounter As Long Dim lWkValue As Long Dim PosX As Long Dim PosY1 As Long Dim PosY2 As Long Dim TPX As Long pPaintInto.Cls TPX = Screen.TwipsPerPixelX sValidChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*" sValidCodes = "41914595664727860970419025962647338417105957" + _ "84729059950476626106644590602984801043246599" + _ "62476744460260046477586109044686603224803443" + _ "91860130478424477058030365265828235758580903" + _ "65863556658042365383495434978353624150635770" sToCode = UCase(IIf(Left(sToCode, 1) = "*", "", "*") + sToCode + IIf(Right(sToCode, 1) = "*", "", "*")) PosX = ((((pPaintInto.Width / TPX) - (Len(sToCode) * 16)) / 2) * TPX) - 1 PosY1 = pPaintInto.Height * 0.2 PosY2 = pPaintInto.Height * 0.8 If PosX < 0 Then MsgBox "The length of the code exceeds control limits.", vbExclamation, "Large string" GoTo End_Code End If On Error Resume Next For lCounter = 1 To Len(sToCode) 'Here is where the number is fetched from the sValidCodes string. It will get only 5 digits. lWkValue = Val(Mid(sValidCodes, ((InStr(1, sValidChars, Mid(sToCode, lCounter, 1)) - 1) * 5) + 1, 5)) lWkValue = IIf(lWkValue = 0, 36538, lWkValue) For lElevate = 15 To 0 Step -1 'It evaluates the binary number to see if it has to draw a line. If lWkValue >= 2 ^ lElevate Then pPaintInto.Line (PosX, PosY1)-(PosX, PosY2) lWkValue = lWkValue - (2 ^ lElevate) End If PosX = PosX + TPX Next Next pLabelInto.Caption = Mid(sToCode, 2, Len(sToCode) - 2) End_Code: End Sub
Orijinal Yorumlar (3)
Wayback Machine'den kurtarıldı