-
Notifications
You must be signed in to change notification settings - Fork 1
/
Form1.vb
746 lines (619 loc) · 22.6 KB
/
Form1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
#Region "#Usings"
Imports System
Imports System.Collections.Generic
Imports System.Drawing.Printing
Imports System.Windows.Forms
Imports DevExpress.XtraPrinting.BarCode
Imports DevExpress.XtraReports.UI
' ...
#End Region ' #Usings
Namespace WindowsFormsApplication1
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Enum BarCodeTypes
Codabar
Code11
Code39
Code39Extended
Code93
Code93Extended
Code128
EAN8
EAN13
GS1128
GS1DataBar
DataMatrix
DataMatrixGS1
Industrial2of5
IntelligentMail
IntelligentMailPackage
Interleaved2of5
Matrix2of5
CodeMSI
PDF417
PostNet
QRCode
UPCA
UPCE0
UPCE1
UPCSupplemental2
UPCSupplemental5
UPCShippingContainer
End Enum
#Region "#DataSource"
Private Class BarCode
Public Property Type() As BarCodeTypes
Public Property DisplayName() As String
Public Sub New(ByVal BarCodeType As BarCodeTypes, ByVal BarCodeName As String)
Type = BarCodeType
DisplayName = BarCodeName
End Sub
End Class
Private Function MakeBarCodesList() As List(Of BarCode)
Dim list As New List(Of BarCode)()
list.Add(New BarCode(BarCodeTypes.Codabar, "Codabar"))
list.Add(New BarCode(BarCodeTypes.Code11, "Code 11 (USD-8)"))
list.Add(New BarCode(BarCodeTypes.Code39, "Code 39 (USD-3)"))
list.Add(New BarCode(BarCodeTypes.Code39Extended, "Code 39 Extended"))
list.Add(New BarCode(BarCodeTypes.Code93, "Code 93"))
list.Add(New BarCode(BarCodeTypes.Code93Extended, "Code 93 Extended"))
list.Add(New BarCode(BarCodeTypes.Code128, "Code 128"))
list.Add(New BarCode(BarCodeTypes.EAN8, "EAN 8"))
list.Add(New BarCode(BarCodeTypes.EAN13, "EAN 13"))
list.Add(New BarCode(BarCodeTypes.GS1128, "GS1-128 - EAN-128 (UCC)"))
list.Add(New BarCode(BarCodeTypes.GS1DataBar, "GS1 DataBar"))
list.Add(New BarCode(BarCodeTypes.DataMatrix, "Data Matrix (ECC200)"))
list.Add(New BarCode(BarCodeTypes.DataMatrixGS1, "Data Matrix (GS1)"))
list.Add(New BarCode(BarCodeTypes.Industrial2of5, "Industrial 2 of 5"))
list.Add(New BarCode(BarCodeTypes.IntelligentMail, "Intelligent Mail"))
list.Add(New BarCode(BarCodeTypes.IntelligentMailPackage, "Intelligent Mail Package"))
list.Add(New BarCode(BarCodeTypes.Interleaved2of5, "Interleaved 2 of 5"))
list.Add(New BarCode(BarCodeTypes.Matrix2of5, "Matrix 2 of 5"))
list.Add(New BarCode(BarCodeTypes.CodeMSI, "MSI/Plessey"))
list.Add(New BarCode(BarCodeTypes.PDF417, "PDF417"))
list.Add(New BarCode(BarCodeTypes.PostNet, "PostNet"))
list.Add(New BarCode(BarCodeTypes.QRCode, "QR Code"))
list.Add(New BarCode(BarCodeTypes.UPCA, "UPC-A"))
list.Add(New BarCode(BarCodeTypes.UPCE0, "UPC-E0"))
list.Add(New BarCode(BarCodeTypes.UPCE1, "UPC-E1"))
list.Add(New BarCode(BarCodeTypes.UPCSupplemental2, "UPC Supplemental 2"))
list.Add(New BarCode(BarCodeTypes.UPCShippingContainer, "UPC Shipping Container Symbol (ITF-14)"))
Return list
End Function
#End Region ' #DataSource
#Region "#Codabar"
Public Function CreateCodabarBarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to Codabar
barCode.Symbology = New CodabarGenerator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 300
barCode.Height = 100
' Adjust the properties specific to the bar code type.
CType(barCode.Symbology, CodabarGenerator).StartStopPair = CodabarStartStopPair.BN
CType(barCode.Symbology, CodabarGenerator).WideNarrowRatio = 2.5F
Return barCode
End Function
#End Region ' #Codabar
#Region "#Code11"
Public Function CreateCode11BarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to Code 11.
barCode.Symbology = New Code11Generator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 400
barCode.Height = 100
Return barCode
End Function
#End Region ' #Code11
#Region "#Code39"
Public Function CreateCode39BarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to Code 39.
barCode.Symbology = New Code39Generator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 400
barCode.Height = 100
' Adjust the properties specific to the bar code type.
CType(barCode.Symbology, Code39Generator).CalcCheckSum = False
CType(barCode.Symbology, Code39Generator).WideNarrowRatio = 2.5F
Return barCode
End Function
#End Region ' #Code39
#Region "#Code39Extended"
Public Function CreateCode39ExBarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to Code 39 Extended.
barCode.Symbology = New Code39ExtendedGenerator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 400
barCode.Height = 100
' Adjust the properties specific to the bar code type.
CType(barCode.Symbology, Code39ExtendedGenerator).CalcCheckSum = False
CType(barCode.Symbology, Code39ExtendedGenerator).WideNarrowRatio = 2.5F
Return barCode
End Function
#End Region ' #Code39Extended
#Region "#Code93"
Public Function CreateCode93BarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to Code 93.
barCode.Symbology = New Code93Generator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 400
barCode.Height = 100
' Adjust the properties specific to the bar code type.
CType(barCode.Symbology, Code93Generator).CalcCheckSum = False
Return barCode
End Function
#End Region ' #Code93
#Region "#Code93Extended"
Public Function CreateCode93ExBarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to Code 93 Extended.
barCode.Symbology = New Code93ExtendedGenerator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 400
barCode.Height = 100
' Adjust the properties specific to the bar code type.
CType(barCode.Symbology, Code93ExtendedGenerator).CalcCheckSum = False
Return barCode
End Function
#End Region ' #Code93Extended
#Region "#Code128"
Public Function CreateCode128BarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to Code 128.
barCode.Symbology = New Code128Generator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 400
barCode.Height = 100
' Adjust the properties specific to the bar code type.
CType(barCode.Symbology, Code128Generator).CharacterSet = Code128Charset.CharsetB
Return barCode
End Function
#End Region ' #Code128
#Region "#EAN8"
Public Function CreateEAN8BarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to EAN 8.
barCode.Symbology = New EAN8Generator()
' Adjust the barcode's main properties.
barCode.Text = BarCodeText
barCode.Width = 400
barCode.Height = 100
Return barCode
End Function
#End Region ' #EAN8
#Region "#EAN13"
Public Function CreateEAN13BarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to EAN 13.
barCode.Symbology = New EAN13Generator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 275
barCode.Height = 200
Return barCode
End Function
#End Region ' #EAN13
#Region "#GS1-128-EAN128"
Public Function CreateGS1128BarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to EAN 128.
barCode.Symbology = New EAN128Generator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 400
barCode.Height = 100
' Adjust the properties specific to the bar code type.
CType(barCode.Symbology, EAN128Generator).CharacterSet = Code128Charset.CharsetB
Return barCode
End Function
#End Region ' #GS1-128-EAN128
#Region "#GS1-DataBar"
Public Function CreateDataBarGS1BarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to GS1 DataBar.
barCode.Symbology = New DataBarGenerator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 250
barCode.Height = 160
' Adjust the properties specific to the bar code type.
CType(barCode.Symbology, DataBarGenerator).FNC1Substitute = "#"
CType(barCode.Symbology, DataBarGenerator).SegmentsInRow = 4
CType(barCode.Symbology, DataBarGenerator).Type = DataBarType.ExpandedStacked
Return barCode
End Function
#End Region ' #GS1-DataBar
#Region "#DataMatrixECC200"
Public Function CreateDataMatrixBarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to DataMatrix.
barCode.Symbology = New DataMatrixGenerator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 400
barCode.Height = 150
' If the AutoModule property is set to false, uncomment the next line.
barCode.AutoModule = True
'barcode.Module = 3;
' Adjust the properties specific to the bar code type.
CType(barCode.Symbology, DataMatrixGenerator).CompactionMode = DataMatrixCompactionMode.Text
CType(barCode.Symbology, DataMatrixGenerator).MatrixSize = DataMatrixSize.MatrixAuto
Return barCode
End Function
#End Region ' #DataMatrixECC200
#Region "#DataMatrixGS1"
Public Function CreateDataMatrixGS1BarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to Data Matrix GS1.
barCode.Symbology = New DataMatrixGS1Generator()
' Adjust the bar code's main properties.
barCode.AutoModule = True
barCode.Text = BarCodeText
barCode.ShowText = True
barCode.Width = 200
barCode.Height = 200
' Adjust the properties specific to the bar code type.
' (Assigned below are the default values.)
CType(barCode.Symbology, DataMatrixGS1Generator).FNC1Substitute = "#"
CType(barCode.Symbology, DataMatrixGS1Generator).HumanReadableText = True
CType(barCode.Symbology, DataMatrixGS1Generator).MatrixSize = DataMatrixSize.MatrixAuto
Return barCode
End Function
#End Region ' #DataMatrixGS1
#Region "#Industrial2of5"
Public Function CreateIndustrial2of5BarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to Industrial 2 of 5.
barCode.Symbology = New Industrial2of5Generator()
' Adjust the main properties of the bar code.
barCode.Text = BarCodeText
barCode.Width = 400
barCode.Height = 100
' Adjust the properties specific to the bar code type.
CType(barCode.Symbology, Industrial2of5Generator).CalcCheckSum = False
CType(barCode.Symbology, Industrial2of5Generator).WideNarrowRatio = 3
Return barCode
End Function
#End Region ' #Industrial2of5
#Region "#IntelligentMail"
Public Function CreateIntelligentMailBarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to Intelligent Mail.
barCode.Symbology = New IntelligentMailGenerator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.ShowText = True
barCode.WidthF = 300F
barCode.HeightF = 50F
' If the AutoModule property is set to false, uncomment the next line.
barCode.AutoModule = True
'barcode.Module = 3;
Return barCode
End Function
#End Region ' #IntelligentMail
#Region "#IntelligentMailPackage"
Public Function CreateIntelligentMailPackageBarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to Intelligent Mail Package.
barCode.Symbology = New IntelligentMailPackageGenerator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.ShowText = False
barCode.WidthF = 300
barCode.HeightF = 150F
' If the AutoModule property is set to false, uncomment the next line.
barCode.AutoModule = True
'barcode.Module = 3;
' Adjust the property specific to the bar code type.
' (Assigned below is the default value.)
CType(barCode.Symbology, IntelligentMailPackageGenerator).FNC1Substitute = "#"
Return barCode
End Function
#End Region ' #IntelligentMailPackage
#Region "#Interleaved2of5"
Public Function CreateInterleaved2of5BarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code controle.
Dim barCode As New XRBarCode()
' Set the bar code's type to Interleaved 2 of 5.
barCode.Symbology = New Interleaved2of5Generator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 400
barCode.Height = 100
' Adjust the properties specific to the bar code type.
CType(barCode.Symbology, Interleaved2of5Generator).CalcCheckSum = False
CType(barCode.Symbology, Interleaved2of5Generator).WideNarrowRatio = 3
Return barCode
End Function
#End Region ' #Interleaved2of5
#Region "#Matrix2of5"
Public Function CreateMatrix2of5BarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to Matrix 2 of 5.
barCode.Symbology = New Matrix2of5Generator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 400
barCode.Height = 100
' Adjust the properties specific to the bar code type.
CType(barCode.Symbology, Matrix2of5Generator).CalcCheckSum = False
CType(barCode.Symbology, Matrix2of5Generator).WideNarrowRatio = 3
Return barCode
End Function
#End Region ' #Matrix2of5
#Region "#MSI-Plessey"
Public Function CreateCodeMSIBarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to MSI.
barCode.Symbology = New CodeMSIGenerator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 400
barCode.Height = 100
' Adjust the properties specific to the bar code type.
CType(barCode.Symbology, CodeMSIGenerator).MSICheckSum = MSICheckSum.DoubleModulo10
Return barCode
End Function
#End Region ' #MSI-Plessey
#Region "#PDF417"
Public Function CreatePDF417BarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to PDF417.
barCode.Symbology = New PDF417Generator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 400
barCode.Height = 150
' If the AutoModule property is set to false, uncomment the next line.
barCode.AutoModule = True
'barcode.Module = 3;
' Adjust the properties specific to the bar code type.
CType(barCode.Symbology, PDF417Generator).Columns = 1
CType(barCode.Symbology, PDF417Generator).CompactionMode = PDF417CompactionMode.Text
CType(barCode.Symbology, PDF417Generator).ErrorCorrectionLevel = ErrorCorrectionLevel.Level2
CType(barCode.Symbology, PDF417Generator).Rows = 9
CType(barCode.Symbology, PDF417Generator).TruncateSymbol = False
CType(barCode.Symbology, PDF417Generator).YToXRatio = 3
Return barCode
End Function
#End Region ' #PDF417
#Region "#PostNet"
Public Function CreatePostNetBarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to PostNet.
barCode.Symbology = New PostNetGenerator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 400
barCode.Height = 100
Return barCode
End Function
#End Region ' #PostNet
#Region "#QRCode"
Public Function CreateQRCodeBarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to QRCode.
barCode.Symbology = New QRCodeGenerator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 400
barCode.Height = 150
' If the AutoModule property is set to false, uncomment the next line.
barCode.AutoModule = True
' barcode.Module = 3;
' Adjust the properties specific to the bar code type.
CType(barCode.Symbology, QRCodeGenerator).CompactionMode = QRCodeCompactionMode.AlphaNumeric
CType(barCode.Symbology, QRCodeGenerator).ErrorCorrectionLevel = QRCodeErrorCorrectionLevel.H
CType(barCode.Symbology, QRCodeGenerator).Version = QRCodeVersion.AutoVersion
Return barCode
End Function
#End Region ' #QRCode
#Region "#UPC-A"
Public Function CreateUPCABarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to UPC-A.
barCode.Symbology = New UPCAGenerator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 275
barCode.Height = 200
Return barCode
End Function
#End Region ' #UPC-A
#Region "#UPC-E0"
Public Function CreateUPCE0BarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to UPC-E0.
barCode.Symbology = New UPCE0Generator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 400
barCode.Height = 100
Return barCode
End Function
#End Region ' #UPC-E0
#Region "#UPC-E1"
Public Function CreateUPCE1BarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to UPC-E1.
barCode.Symbology = New UPCE1Generator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 400
barCode.Height = 100
Return barCode
End Function
#End Region ' #UPC-E1
#Region "#UPCSupplemental2"
Public Function CreateUPCSupplemental2BarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to UPC Supplemental 2.
barCode.Symbology = New UPCSupplemental2Generator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 100
barCode.Height = 55
Return barCode
End Function
#End Region ' #UPCSupplemental2
#Region "#UPCSupplemental5"
Public Function CreateUPCSupplemental5BarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to UPC Supplemental 5.
barCode.Symbology = New UPCSupplemental5Generator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 150
barCode.Height = 55
Return barCode
End Function
#End Region ' #UPCSupplemental5
#Region "#UPCShippingContainer"
Public Function CreateITF14BarCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the barcode's type to ITF-14.
barCode.Symbology = New ITF14Generator()
' Adjust the bar code's main properties.
barCode.Text = BarCodeText
barCode.Width = 350
barCode.Height = 100
' Adjust the properties specific to the bar code type.
CType(barCode.Symbology, ITF14Generator).CalcCheckSum = False
CType(barCode.Symbology, ITF14Generator).WideNarrowRatio = 2.5F
Return barCode
End Function
#End Region ' #UPCShippingContainer
#Region "#CreateBarCode"
Private Function CreateBarCode(ByVal Type As BarCodeTypes) As XRBarCode
Dim barCode As XRBarCode = Nothing
Select Case Type
Case BarCodeTypes.Codabar
barCode = CreateCodabarBarCode("0123-456789")
Case BarCodeTypes.Code11
barCode = CreateCode11BarCode("0123-456789")
Case BarCodeTypes.Code39
barCode = CreateCode39BarCode("01234-ABCD")
Case BarCodeTypes.Code39Extended
barCode = CreateCode39ExBarCode("012-Abc")
Case BarCodeTypes.Code93
barCode = CreateCode93BarCode("01234-ABCD")
Case BarCodeTypes.Code93Extended
barCode = CreateCode93ExBarCode("012-Abc")
Case BarCodeTypes.Code128
barCode = CreateCode128BarCode("01234-ABcd")
Case BarCodeTypes.EAN8
barCode = CreateEAN8BarCode("01234567")
Case BarCodeTypes.EAN13
barCode = CreateEAN13BarCode("0123456789")
Case BarCodeTypes.GS1128
barCode = CreateGS1128BarCode("01234-Abcd")
Case BarCodeTypes.GS1DataBar
barCode = CreateDataBarGS1BarCode("01906141410000153202000150")
Case BarCodeTypes.DataMatrix
barCode = CreateDataMatrixBarCode("01234-ABCD")
Case BarCodeTypes.DataMatrixGS1
barCode = CreateDataMatrixGS1BarCode("01234-ABCD")
Case BarCodeTypes.Industrial2of5
barCode = CreateIndustrial2of5BarCode("0123456789")
Case BarCodeTypes.IntelligentMail
barCode = CreateIntelligentMailBarCode("4408200000012345678991203")
Case BarCodeTypes.IntelligentMailPackage
barCode = CreateIntelligentMailPackageBarCode("9212391234567812345671")
Case BarCodeTypes.Interleaved2of5
barCode = CreateInterleaved2of5BarCode("0123456789")
Case BarCodeTypes.Matrix2of5
barCode = CreateMatrix2of5BarCode("0123456789")
Case BarCodeTypes.CodeMSI
barCode = CreateCodeMSIBarCode("0123456789")
Case BarCodeTypes.PDF417
barCode = CreatePDF417BarCode("01234-ABCD")
Case BarCodeTypes.PostNet
barCode = CreatePostNetBarCode("0123456789")
Case BarCodeTypes.QRCode
barCode = CreateQRCodeBarCode("01234-ABCD")
Case BarCodeTypes.UPCA
barCode = CreateUPCABarCode("00123456789")
Case BarCodeTypes.UPCE0
barCode = CreateUPCE0BarCode("123")
Case BarCodeTypes.UPCE1
barCode = CreateUPCE1BarCode("123")
Case BarCodeTypes.UPCSupplemental2
barCode = CreateUPCSupplemental2BarCode("01")
Case BarCodeTypes.UPCSupplemental5
barCode = CreateUPCSupplemental5BarCode("01234")
Case BarCodeTypes.UPCShippingContainer
barCode = CreateITF14BarCode("1234567890123")
End Select
Return barCode
End Function
#End Region ' #CreateBarCode
#Region "#PublishReport"
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
If Not Me.button1.IsHandleCreated Then Return
' Create a report and handle its BeforPrint event.
Dim report As New XtraReport()
AddHandler report.BeforePrint, AddressOf report_BeforePrint
' Show the report's preview.
report.ShowPreview()
End Sub
#End Region ' #PublishReport
#Region "#AddBarCode"
Private Sub report_BeforePrint(ByVal sender As Object, ByVal e As PrintEventArgs)
' Create a bar code control.
Dim barCode As XRBarCode = CreateBarCode(DirectCast(comboBox1.SelectedValue, BarCodeTypes))
' Create a Detail band and add the bar code to it.
DirectCast(sender, XtraReport).Bands.Add(New DetailBand())
DirectCast(sender, XtraReport).Bands(BandKind.Detail).Controls.Add(barCode)
End Sub
#End Region ' #AddBarCode
#Region "#PopulateComboBox"
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim data As List(Of BarCode) = MakeBarCodesList()
comboBox1.DataSource = data
comboBox1.DisplayMember = "DisplayName"
comboBox1.ValueMember = "Type"
End Sub
#End Region ' #PopulateComboBox
End Class
End Namespace