-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBarcodes.vb
More file actions
53 lines (36 loc) · 1.55 KB
/
Barcodes.vb
File metadata and controls
53 lines (36 loc) · 1.55 KB
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
Namespace CardonerSistemas
Module Barcodes
Friend Const QRCodeDataField As String = "{DATA}"
Friend Function CreateQR() As Bitmap
'Create a new QR bitmap image
Dim bmp As New Bitmap(21, 21)
'Get the graphics object to manipulate the bitmap
Dim gr As Drawing.Graphics = System.Drawing.Graphics.FromImage(bmp)
'Set the background of the bitmap to white
gr.FillRectangle(Brushes.White, 0, 0, 21, 21)
'Draw position detection patterns
'Top Left
gr.DrawRectangle(Pens.Black, 0, 0, 6, 6)
gr.FillRectangle(Brushes.Black, 2, 2, 3, 3)
'Top Right
gr.DrawRectangle(Pens.Black, 14, 0, 6, 6)
gr.FillRectangle(Brushes.Black, 2, 16, 3, 3)
'Bottom Left
gr.DrawRectangle(Pens.Black, 0, 14, 6, 6)
gr.FillRectangle(Brushes.Black, 16, 2, 3, 3)
'*** Drawing pixels is done off the bitmap object, not the graphics object
'Arbitrary black pixel
bmp.SetPixel(8, 14, Color.Black)
'Top timing pattern
bmp.SetPixel(8, 6, Color.Black)
bmp.SetPixel(10, 6, Color.Black)
bmp.SetPixel(12, 6, Color.Black)
'Left timing pattern
bmp.SetPixel(6, 8, Color.Black)
bmp.SetPixel(6, 10, Color.Black)
bmp.SetPixel(6, 12, Color.Black)
'Add code here to set the rest of the pixels as needed
Return bmp
End Function
End Module
End Namespace