|
-
Sep 19th, 2001, 09:46 PM
#1
Thread Starter
Lively Member
barcode
I am using barcode 39 but the barcode is too long horizontally(left and right) for my label so what I need to do is figure out how to shorten the barcode without changing the data that is strored in the barcode. I think I can do this by changing the density of the barcode but I don't know how to do this. Can anyone help me with this?
Here is my code:
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
Dim xMiddle As Single
' pPaintInto.Cls
TPX = 15 'Screen.TwipsPerPixelX
sValidChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*"
sValidCodes = "41914595664727860970419025962647338417105957" + _
"84729059950476626106644590602984801043246599" + _
"62476744460260046477586109044686603224803443" + _
"91860130478424477058030365265828235758580903" + _
"65863556658042365383495434978353624150635770"
sToCode = UCase(IIf(Left(sToCode, 1) = "*", "", "*") + sToCode + IIf(Right(sToCode, 1) = "*", "", "*"))
PosX = (rX1 + (rX2 - rX1) / 2) - (((Len(sToCode) * 16) / 2) * TPX) - 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
'PosX = rX1
For lCounter = 1 To Len(sToCode)
'Here is where the number is fetched fro
' m the sValidCodes string. It will get on
' ly 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 i
' f it has to draw a line.
If lWkValue >= 2 ^ lElevate Then
' pPaintInto.Line (PosX, PosY1)-(PosX, PosY2)
vspCurrent.DrawLine PosX, rY1 + 0.05 * TPI, _
PosX, RY1+rBarHeight
lWkValue = lWkValue - (2 ^ lElevate)
End If
PosX = PosX + TPX
Next
Next
' pLabelInto.caption = Mid(sToCode, 2, Len(sToCode) - 2)
End_Code:
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|