QRCode対応高性能完全無料ライブラリー
DotNetBarcodeサンプルプログラムのソースコード(全部)


Partial Public Class BarCodeSample
Inherits System.Windows.Forms.Form

#Region " Windows フォーム デザイナで生成されたコード "

Public Sub New()
MyBase.New()

' この呼び出しは Windows フォーム デザイナで必要です。
InitializeComponent()

' InitializeComponent() 呼び出しの後に初期化を追加します。

End Sub

' Form は、コンポーネント一覧に後処理を実行するために dispose をオーバーライドします。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

' Windows フォーム デザイナで必要です。
Private components As System.ComponentModel.IContainer

' メモ : 以下のプロシージャは、Windows フォーム デザイナで必要です。
'Windows フォーム デザイナを使って変更してください。
' コード エディタを使って変更しないでください。
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents BarNumber As System.Windows.Forms.TextBox
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton3 As System.Windows.Forms.RadioButton
Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox
Friend WithEvents ColorDialog1 As System.Windows.Forms.ColorDialog
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents Button5 As System.Windows.Forms.Button
Friend WithEvents Button6 As System.Windows.Forms.Button
Friend WithEvents FontDialog1 As System.Windows.Forms.FontDialog
Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox
Friend WithEvents CheckBox2 As System.Windows.Forms.CheckBox
Friend WithEvents CheckBox3 As System.Windows.Forms.CheckBox
Friend WithEvents Button7 As System.Windows.Forms.Button
Friend WithEvents CheckBox4 As System.Windows.Forms.CheckBox
Friend WithEvents Button8 As System.Windows.Forms.Button
Friend WithEvents GroupBox4 As System.Windows.Forms.GroupBox
Friend WithEvents Button9 As System.Windows.Forms.Button
Friend WithEvents Button10 As System.Windows.Forms.Button
Friend WithEvents Button11 As System.Windows.Forms.Button
Friend WithEvents SaveFileDialog1 As System.Windows.Forms.SaveFileDialog
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.BarNumber = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
Me.Button3 = New System.Windows.Forms.Button
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.GroupBox2 = New System.Windows.Forms.GroupBox
Me.GroupBox6 = New System.Windows.Forms.GroupBox
Me.Label8 = New System.Windows.Forms.Label
Me.RadioButton8 = New System.Windows.Forms.RadioButton
Me.NumericUpDown5 = New System.Windows.Forms.NumericUpDown
Me.RadioButton7 = New System.Windows.Forms.RadioButton
Me.RadioButton5 = New System.Windows.Forms.RadioButton
Me.RadioButton6 = New System.Windows.Forms.RadioButton
Me.Button17 = New System.Windows.Forms.Button
Me.Button16 = New System.Windows.Forms.Button
Me.Label7 = New System.Windows.Forms.Label
Me.NumericUpDown4 = New System.Windows.Forms.NumericUpDown
Me.Label6 = New System.Windows.Forms.Label
Me.NumericUpDown3 = New System.Windows.Forms.NumericUpDown
Me.NumericUpDown2 = New System.Windows.Forms.NumericUpDown
Me.Label5 = New System.Windows.Forms.Label
Me.Button15 = New System.Windows.Forms.Button
Me.Label4 = New System.Windows.Forms.Label
Me.NumericUpDown1 = New System.Windows.Forms.NumericUpDown
Me.Panel1 = New System.Windows.Forms.Panel
Me.Label3 = New System.Windows.Forms.Label
Me.Button14 = New System.Windows.Forms.Button
Me.Button13 = New System.Windows.Forms.Button
Me.Button12 = New System.Windows.Forms.Button
Me.GroupBox5 = New System.Windows.Forms.GroupBox
Me.RadioTiff = New System.Windows.Forms.RadioButton
Me.RadioPng = New System.Windows.Forms.RadioButton
Me.RadioGif = New System.Windows.Forms.RadioButton
Me.RadioJpeg = New System.Windows.Forms.RadioButton
Me.RadioBitMap = New System.Windows.Forms.RadioButton
Me.Label2 = New System.Windows.Forms.Label
Me.Button11 = New System.Windows.Forms.Button
Me.Button7 = New System.Windows.Forms.Button
Me.CheckBox3 = New System.Windows.Forms.CheckBox
Me.CheckBox2 = New System.Windows.Forms.CheckBox
Me.CheckBox1 = New System.Windows.Forms.CheckBox
Me.Button6 = New System.Windows.Forms.Button
Me.Button5 = New System.Windows.Forms.Button
Me.GroupBox3 = New System.Windows.Forms.GroupBox
Me.RadioButton4 = New System.Windows.Forms.RadioButton
Me.RadioButton1 = New System.Windows.Forms.RadioButton
Me.RadioButton2 = New System.Windows.Forms.RadioButton
Me.RadioButton3 = New System.Windows.Forms.RadioButton
Me.Button4 = New System.Windows.Forms.Button
Me.GroupBox4 = New System.Windows.Forms.GroupBox
Me.Button10 = New System.Windows.Forms.Button
Me.Button9 = New System.Windows.Forms.Button
Me.Button8 = New System.Windows.Forms.Button
Me.CheckBox4 = New System.Windows.Forms.CheckBox
Me.ColorDialog1 = New System.Windows.Forms.ColorDialog
Me.FontDialog1 = New System.Windows.Forms.FontDialog
Me.SaveFileDialog1 = New System.Windows.Forms.SaveFileDialog
Me.Label9 = New System.Windows.Forms.Label
Me.GroupBox1.SuspendLayout()
Me.GroupBox2.SuspendLayout()
Me.GroupBox6.SuspendLayout()
CType(Me.NumericUpDown5, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.NumericUpDown4, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.NumericUpDown3, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.NumericUpDown2, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.GroupBox5.SuspendLayout()
Me.GroupBox3.SuspendLayout()
Me.GroupBox4.SuspendLayout()
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(410, 24)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(353, 24)
Me.Button1.TabIndex = 0
Me.Button1.Text = "サンプルBarCodeの印刷"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(97, 18)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(119, 24)
Me.Button2.TabIndex = 1
Me.Button2.Text = "バーコードの表示"
'
'BarNumber
'
Me.BarNumber.Location = New System.Drawing.Point(6, 48)
Me.BarNumber.Multiline = True
Me.BarNumber.Name = "BarNumber"
Me.BarNumber.Size = New System.Drawing.Size(210, 134)
Me.BarNumber.TabIndex = 2
Me.BarNumber.Text = "123456789"
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(6, 24)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(85, 12)
Me.Label1.TabIndex = 3
Me.Label1.Text = "バーコードを入力"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(19, 24)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(366, 24)
Me.Button3.TabIndex = 5
Me.Button3.Text = "サンプルBarCodeの印刷プレビュー"
'
'GroupBox1
'
Me.GroupBox1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.GroupBox1.Controls.Add(Me.Button3)
Me.GroupBox1.Controls.Add(Me.Button1)
Me.GroupBox1.Location = New System.Drawing.Point(8, 8)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(787, 56)
Me.GroupBox1.TabIndex = 7
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "サンプルBarCodeの印刷と印刷プレビュー"
'
'GroupBox2
'
Me.GroupBox2.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.GroupBox2.Controls.Add(Me.Label9)
Me.GroupBox2.Controls.Add(Me.GroupBox6)
Me.GroupBox2.Controls.Add(Me.Button17)
Me.GroupBox2.Controls.Add(Me.Button16)
Me.GroupBox2.Controls.Add(Me.Label7)
Me.GroupBox2.Controls.Add(Me.NumericUpDown4)
Me.GroupBox2.Controls.Add(Me.Label6)
Me.GroupBox2.Controls.Add(Me.NumericUpDown3)
Me.GroupBox2.Controls.Add(Me.NumericUpDown2)
Me.GroupBox2.Controls.Add(Me.Label5)
Me.GroupBox2.Controls.Add(Me.Button15)
Me.GroupBox2.Controls.Add(Me.Label4)
Me.GroupBox2.Controls.Add(Me.NumericUpDown1)
Me.GroupBox2.Controls.Add(Me.Panel1)
Me.GroupBox2.Controls.Add(Me.Label3)
Me.GroupBox2.Controls.Add(Me.Button14)
Me.GroupBox2.Controls.Add(Me.Button13)
Me.GroupBox2.Controls.Add(Me.Button12)
Me.GroupBox2.Controls.Add(Me.GroupBox5)
Me.GroupBox2.Controls.Add(Me.Label2)
Me.GroupBox2.Controls.Add(Me.Button11)
Me.GroupBox2.Controls.Add(Me.Label1)
Me.GroupBox2.Controls.Add(Me.Button7)
Me.GroupBox2.Controls.Add(Me.Button2)
Me.GroupBox2.Controls.Add(Me.CheckBox3)
Me.GroupBox2.Controls.Add(Me.CheckBox2)
Me.GroupBox2.Controls.Add(Me.CheckBox1)
Me.GroupBox2.Controls.Add(Me.Button6)
Me.GroupBox2.Controls.Add(Me.Button5)
Me.GroupBox2.Controls.Add(Me.BarNumber)
Me.GroupBox2.Controls.Add(Me.GroupBox3)
Me.GroupBox2.Controls.Add(Me.Button4)
Me.GroupBox2.Controls.Add(Me.GroupBox4)
Me.GroupBox2.Location = New System.Drawing.Point(8, 72)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(787, 487)
Me.GroupBox2.TabIndex = 8
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "BarCodeの表示テスト"
'
'GroupBox6
'
Me.GroupBox6.Controls.Add(Me.Label8)
Me.GroupBox6.Controls.Add(Me.RadioButton8)
Me.GroupBox6.Controls.Add(Me.NumericUpDown5)
Me.GroupBox6.Controls.Add(Me.RadioButton7)
Me.GroupBox6.Controls.Add(Me.RadioButton5)
Me.GroupBox6.Controls.Add(Me.RadioButton6)
Me.GroupBox6.Location = New System.Drawing.Point(600, 185)
Me.GroupBox6.Name = "GroupBox6"
Me.GroupBox6.Size = New System.Drawing.Size(163, 73)
Me.GroupBox6.TabIndex = 42
Me.GroupBox6.TabStop = False
Me.GroupBox6.Text = "回転角度指定"
'
'Label8
'
Me.Label8.AutoSize = True
Me.Label8.Location = New System.Drawing.Point(6, 44)
Me.Label8.Name = "Label8"
Me.Label8.Size = New System.Drawing.Size(71, 12)
Me.Label8.TabIndex = 35
Me.Label8.Text = "QRCode専用"
'
'RadioButton8
'
Me.RadioButton8.AutoSize = True
Me.RadioButton8.Location = New System.Drawing.Point(117, 22)
Me.RadioButton8.Name = "RadioButton8"
Me.RadioButton8.Size = New System.Drawing.Size(41, 16)
Me.RadioButton8.TabIndex = 41
Me.RadioButton8.TabStop = True
Me.RadioButton8.Text = "270"
Me.RadioButton8.UseVisualStyleBackColor = True
'
'NumericUpDown5
'
Me.NumericUpDown5.Location = New System.Drawing.Point(82, 41)
Me.NumericUpDown5.Maximum = New Decimal(New Integer() {3600, 0, 0, 0})
Me.NumericUpDown5.Minimum = New Decimal(New Integer() {3600, 0, 0, -2147483648})
Me.NumericUpDown5.Name = "NumericUpDown5"
Me.NumericUpDown5.Size = New System.Drawing.Size(75, 19)
Me.NumericUpDown5.TabIndex = 34
'
'RadioButton7
'
Me.RadioButton7.AutoSize = True
Me.RadioButton7.Location = New System.Drawing.Point(75, 22)
Me.RadioButton7.Name = "RadioButton7"
Me.RadioButton7.Size = New System.Drawing.Size(41, 16)
Me.RadioButton7.TabIndex = 40
Me.RadioButton7.TabStop = True
Me.RadioButton7.Text = "180"
Me.RadioButton7.UseVisualStyleBackColor = True
'
'RadioButton5
'
Me.RadioButton5.AutoSize = True
Me.RadioButton5.Location = New System.Drawing.Point(11, 22)
Me.RadioButton5.Name = "RadioButton5"
Me.RadioButton5.Size = New System.Drawing.Size(29, 16)
Me.RadioButton5.TabIndex = 38
Me.RadioButton5.TabStop = True
Me.RadioButton5.Text = "0"
Me.RadioButton5.UseVisualStyleBackColor = True
'
'RadioButton6
'
Me.RadioButton6.AutoSize = True
Me.RadioButton6.Location = New System.Drawing.Point(40, 22)
Me.RadioButton6.Name = "RadioButton6"
Me.RadioButton6.Size = New System.Drawing.Size(35, 16)
Me.RadioButton6.TabIndex = 39
Me.RadioButton6.TabStop = True
Me.RadioButton6.Text = "90"
Me.RadioButton6.UseVisualStyleBackColor = True
'
'Button17
'
Me.Button17.Location = New System.Drawing.Point(469, 234)
Me.Button17.Name = "Button17"
Me.Button17.Size = New System.Drawing.Size(104, 23)
Me.Button17.TabIndex = 37
Me.Button17.Text = "背景ファイル削除"
Me.Button17.UseVisualStyleBackColor = True
'
'Button16
'
Me.Button16.Location = New System.Drawing.Point(469, 178)
Me.Button16.Name = "Button16"
Me.Button16.Size = New System.Drawing.Size(104, 24)
Me.Button16.TabIndex = 36
Me.Button16.Text = "背景ファイル選択"
'
'Label7
'
Me.Label7.AutoSize = True
Me.Label7.Location = New System.Drawing.Point(522, 147)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(92, 12)
Me.Label7.TabIndex = 33
Me.Label7.Text = "表示位置(Y座標)"
'
'NumericUpDown4
'
Me.NumericUpDown4.Increment = New Decimal(New Integer() {10, 0, 0, 0})
Me.NumericUpDown4.Location = New System.Drawing.Point(618, 142)
Me.NumericUpDown4.Maximum = New Decimal(New Integer() {1000, 0, 0, 0})
Me.NumericUpDown4.Name = "NumericUpDown4"
Me.NumericUpDown4.Size = New System.Drawing.Size(75, 19)
Me.NumericUpDown4.TabIndex = 32
'
'Label6
'
Me.Label6.AutoSize = True
Me.Label6.Location = New System.Drawing.Point(522, 124)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(92, 12)
Me.Label6.TabIndex = 31
Me.Label6.Text = "表示位置(X座標)"
'
'NumericUpDown3
'
Me.NumericUpDown3.Increment = New Decimal(New Integer() {10, 0, 0, 0})
Me.NumericUpDown3.Location = New System.Drawing.Point(618, 119)
Me.NumericUpDown3.Maximum = New Decimal(New Integer() {1000, 0, 0, 0})
Me.NumericUpDown3.Name = "NumericUpDown3"
Me.NumericUpDown3.Size = New System.Drawing.Size(75, 19)
Me.NumericUpDown3.TabIndex = 30
'
'NumericUpDown2
'
Me.NumericUpDown2.Location = New System.Drawing.Point(720, 60)
Me.NumericUpDown2.Maximum = New Decimal(New Integer() {1000, 0, 0, 0})
Me.NumericUpDown2.Name = "NumericUpDown2"
Me.NumericUpDown2.Size = New System.Drawing.Size(48, 19)
Me.NumericUpDown2.TabIndex = 29
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Location = New System.Drawing.Point(620, 60)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(94, 24)
Me.Label5.TabIndex = 28
Me.Label5.Text = "QRCodeのPixel数" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "(0はサイズ自動)" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10)
'
'Button15
'
Me.Button15.Location = New System.Drawing.Point(222, 164)
Me.Button15.Name = "Button15"
Me.Button15.Size = New System.Drawing.Size(134, 24)
Me.Button15.TabIndex = 27
Me.Button15.Text = "余白の色"
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(620, 42)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(95, 12)
Me.Label4.TabIndex = 26
Me.Label4.Text = "余白(QuitZone)数"
'
'NumericUpDown1
'
Me.NumericUpDown1.Location = New System.Drawing.Point(720, 36)
Me.NumericUpDown1.Maximum = New Decimal(New Integer() {1000, 0, 0, 0})
Me.NumericUpDown1.Name = "NumericUpDown1"
Me.NumericUpDown1.Size = New System.Drawing.Size(48, 19)
Me.NumericUpDown1.TabIndex = 25
Me.NumericUpDown1.Value = New Decimal(New Integer() {4, 0, 0, 0})
'
'Panel1
'
Me.Panel1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Panel1.BackColor = System.Drawing.Color.White
Me.Panel1.Location = New System.Drawing.Point(6, 275)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(775, 206)
Me.Panel1.TabIndex = 6
'
'Label3
'
Me.Label3.Font = New System.Drawing.Font("MS UI Gothic", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(128, Byte))
Me.Label3.ForeColor = System.Drawing.Color.Blue
Me.Label3.Location = New System.Drawing.Point(303, 244)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(135, 28)
Me.Label3.TabIndex = 24
Me.Label3.Text = "フォームを拡大するとバーコードが拡大されます"
'
'Button14
'
Me.Button14.Location = New System.Drawing.Point(222, 112)
Me.Button14.Name = "Button14"
Me.Button14.Size = New System.Drawing.Size(134, 24)
Me.Button14.TabIndex = 23
Me.Button14.Text = "マーク(大)の背景(QR)"
'
'Button13
'
Me.Button13.Location = New System.Drawing.Point(222, 138)
Me.Button13.Name = "Button13"
Me.Button13.Size = New System.Drawing.Size(134, 24)
Me.Button13.TabIndex = 22
Me.Button13.Text = "マーク(小)の色(QRのみ)"
'
'Button12
'
Me.Button12.Location = New System.Drawing.Point(222, 87)
Me.Button12.Name = "Button12"
Me.Button12.Size = New System.Drawing.Size(134, 24)
Me.Button12.TabIndex = 21
Me.Button12.Text = "マーク(大)の色(QRのみ)"
'
'GroupBox5
'
Me.GroupBox5.Controls.Add(Me.RadioTiff)
Me.GroupBox5.Controls.Add(Me.RadioPng)
Me.GroupBox5.Controls.Add(Me.RadioGif)
Me.GroupBox5.Controls.Add(Me.RadioJpeg)
Me.GroupBox5.Controls.Add(Me.RadioBitMap)
Me.GroupBox5.Location = New System.Drawing.Point(362, 42)
Me.GroupBox5.Name = "GroupBox5"
Me.GroupBox5.Size = New System.Drawing.Size(126, 87)
Me.GroupBox5.TabIndex = 20
Me.GroupBox5.TabStop = False
Me.GroupBox5.Text = "書き出すファイル形式"
'
'RadioTiff
'
Me.RadioTiff.AutoSize = True
Me.RadioTiff.Location = New System.Drawing.Point(73, 41)
Me.RadioTiff.Name = "RadioTiff"
Me.RadioTiff.Size = New System.Drawing.Size(41, 16)
Me.RadioTiff.TabIndex = 6
Me.RadioTiff.Text = "Tiff"
Me.RadioTiff.UseVisualStyleBackColor = True
'
'RadioPng
'
Me.RadioPng.AutoSize = True
Me.RadioPng.Location = New System.Drawing.Point(73, 19)
Me.RadioPng.Name = "RadioPng"
Me.RadioPng.Size = New System.Drawing.Size(42, 16)
Me.RadioPng.TabIndex = 5
Me.RadioPng.Text = "Png"
Me.RadioPng.UseVisualStyleBackColor = True
'
'RadioGif
'
Me.RadioGif.AutoSize = True
Me.RadioGif.Location = New System.Drawing.Point(10, 61)
Me.RadioGif.Name = "RadioGif"
Me.RadioGif.Size = New System.Drawing.Size(38, 16)
Me.RadioGif.TabIndex = 2
Me.RadioGif.Text = "Gif"
Me.RadioGif.UseVisualStyleBackColor = True
'
'RadioJpeg
'
Me.RadioJpeg.AutoSize = True
Me.RadioJpeg.Location = New System.Drawing.Point(10, 39)
Me.RadioJpeg.Name = "RadioJpeg"
Me.RadioJpeg.Size = New System.Drawing.Size(48, 16)
Me.RadioJpeg.TabIndex = 1
Me.RadioJpeg.Text = "Jpeg"
Me.RadioJpeg.UseVisualStyleBackColor = True
'
'RadioBitMap
'
Me.RadioBitMap.AutoSize = True
Me.RadioBitMap.Checked = True
Me.RadioBitMap.Location = New System.Drawing.Point(10, 18)
Me.RadioBitMap.Name = "RadioBitMap"
Me.RadioBitMap.Size = New System.Drawing.Size(59, 16)
Me.RadioBitMap.TabIndex = 0
Me.RadioBitMap.TabStop = True
Me.RadioBitMap.Text = "BitMap"
Me.RadioBitMap.UseVisualStyleBackColor = True
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Font = New System.Drawing.Font("MS UI Gothic", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(128, Byte))
Me.Label2.Location = New System.Drawing.Point(4, 185)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(196, 11)
Me.Label2.TabIndex = 19
Me.Label2.Text = "(JANの場合,数字以外の文字は0になります)"
'
'Button11
'
Me.Button11.Location = New System.Drawing.Point(362, 12)
Me.Button11.Name = "Button11"
Me.Button11.Size = New System.Drawing.Size(126, 24)
Me.Button11.TabIndex = 18
Me.Button11.Text = "ファイルへ書き出し"
'
'Button7
'
Me.Button7.Location = New System.Drawing.Point(362, 135)
Me.Button7.Name = "Button7"
Me.Button7.Size = New System.Drawing.Size(126, 24)
Me.Button7.TabIndex = 9
Me.Button7.Text = "クリップボードへコピー"
'
'CheckBox3
'
Me.CheckBox3.Location = New System.Drawing.Point(303, 185)
Me.CheckBox3.Name = "CheckBox3"
Me.CheckBox3.Size = New System.Drawing.Size(160, 24)
Me.CheckBox3.TabIndex = 14
Me.CheckBox3.Text = "チェックディジットを追加"
'
'CheckBox2
'
Me.CheckBox2.Location = New System.Drawing.Point(303, 221)
Me.CheckBox2.Name = "CheckBox2"
Me.CheckBox2.Size = New System.Drawing.Size(160, 24)
Me.CheckBox2.TabIndex = 13
Me.CheckBox2.Text = "チェックディジット文字を表示"
'
'CheckBox1
'
Me.CheckBox1.Checked = True
Me.CheckBox1.CheckState = System.Windows.Forms.CheckState.Checked
Me.CheckBox1.Location = New System.Drawing.Point(303, 203)
Me.CheckBox1.Name = "CheckBox1"
Me.CheckBox1.Size = New System.Drawing.Size(160, 24)
Me.CheckBox1.TabIndex = 12
Me.CheckBox1.Text = "文字を表示"
'
'Button6
'
Me.Button6.Location = New System.Drawing.Point(222, 62)
Me.Button6.Name = "Button6"
Me.Button6.Size = New System.Drawing.Size(134, 24)
Me.Button6.TabIndex = 11
Me.Button6.Text = "フォントの色(QR以外)"
'
'Button5
'
Me.Button5.Location = New System.Drawing.Point(222, 37)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(134, 24)
Me.Button5.TabIndex = 10
Me.Button5.Text = "バーコードの背景色"
'
'GroupBox3
'
Me.GroupBox3.Controls.Add(Me.RadioButton4)
Me.GroupBox3.Controls.Add(Me.RadioButton1)
Me.GroupBox3.Controls.Add(Me.RadioButton2)
Me.GroupBox3.Controls.Add(Me.RadioButton3)
Me.GroupBox3.Location = New System.Drawing.Point(503, 18)
Me.GroupBox3.Name = "GroupBox3"
Me.GroupBox3.Size = New System.Drawing.Size(111, 85)
Me.GroupBox3.TabIndex = 6
Me.GroupBox3.TabStop = False
Me.GroupBox3.Text = "BarCodeのタイプ"
'
'RadioButton4
'
Me.RadioButton4.Checked = True
Me.RadioButton4.Location = New System.Drawing.Point(16, 14)
Me.RadioButton4.Name = "RadioButton4"
Me.RadioButton4.Size = New System.Drawing.Size(88, 16)
Me.RadioButton4.TabIndex = 21
Me.RadioButton4.TabStop = True
Me.RadioButton4.Text = "QRCode"
'
'RadioButton1
'
Me.RadioButton1.Location = New System.Drawing.Point(16, 30)
Me.RadioButton1.Name = "RadioButton1"
Me.RadioButton1.Size = New System.Drawing.Size(88, 16)
Me.RadioButton1.TabIndex = 3
Me.RadioButton1.Text = "JAN13"
'
'RadioButton2
'
Me.RadioButton2.Location = New System.Drawing.Point(16, 45)
Me.RadioButton2.Name = "RadioButton2"
Me.RadioButton2.Size = New System.Drawing.Size(88, 16)
Me.RadioButton2.TabIndex = 4
Me.RadioButton2.Text = "JAN8"
'
'RadioButton3
'
Me.RadioButton3.Location = New System.Drawing.Point(16, 63)
Me.RadioButton3.Name = "RadioButton3"
Me.RadioButton3.Size = New System.Drawing.Size(88, 16)
Me.RadioButton3.TabIndex = 5
Me.RadioButton3.Text = "CODE39"
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(222, 11)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(134, 24)
Me.Button4.TabIndex = 9
Me.Button4.Text = "バーコードの色"
'
'GroupBox4
'
Me.GroupBox4.Controls.Add(Me.Button10)
Me.GroupBox4.Controls.Add(Me.Button9)
Me.GroupBox4.Controls.Add(Me.Button8)
Me.GroupBox4.Controls.Add(Me.CheckBox4)
Me.GroupBox4.Location = New System.Drawing.Point(6, 199)
Me.GroupBox4.Name = "GroupBox4"
Me.GroupBox4.Size = New System.Drawing.Size(265, 70)
Me.GroupBox4.TabIndex = 17
Me.GroupBox4.TabStop = False
Me.GroupBox4.Text = "BarCodeのディバック情報(1次元バーコードのみ)"
'
'Button10
'
Me.Button10.Location = New System.Drawing.Point(102, 33)
Me.Button10.Name = "Button10"
Me.Button10.Size = New System.Drawing.Size(88, 24)
Me.Button10.TabIndex = 18
Me.Button10.Text = "偶数番目の色"
'
'Button9
'
Me.Button9.Location = New System.Drawing.Point(196, 33)
Me.Button9.Name = "Button9"
Me.Button9.Size = New System.Drawing.Size(64, 24)
Me.Button9.TabIndex = 17
Me.Button9.Text = "最後の色"
'
'Button8
'
Me.Button8.Location = New System.Drawing.Point(8, 33)
Me.Button8.Name = "Button8"
Me.Button8.Size = New System.Drawing.Size(88, 24)
Me.Button8.TabIndex = 16
Me.Button8.Text = "奇数番目の色"
'
'CheckBox4
'
Me.CheckBox4.Location = New System.Drawing.Point(16, 11)
Me.CheckBox4.Name = "CheckBox4"
Me.CheckBox4.Size = New System.Drawing.Size(160, 24)
Me.CheckBox4.TabIndex = 15
Me.CheckBox4.Text = "ディバック情報表示"
'
'Label9
'
Me.Label9.Font = New System.Drawing.Font("MS UI Gothic", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(128, Byte))
Me.Label9.ForeColor = System.Drawing.Color.Blue
Me.Label9.Location = New System.Drawing.Point(455, 203)
Me.Label9.Name = "Label9"
Me.Label9.Size = New System.Drawing.Size(128, 28)
Me.Label9.TabIndex = 43
Me.Label9.Text = "背景ファイルは白っぽい" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "色に変換してください。"
'
'BarCodeSample
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 12)
Me.ClientSize = New System.Drawing.Size(803, 564)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.GroupBox2)
Me.Name = "BarCodeSample"
Me.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show
Me.Text = "BarCodeSample"
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox2.PerformLayout()
Me.GroupBox6.ResumeLayout(False)
Me.GroupBox6.PerformLayout()
CType(Me.NumericUpDown5, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.NumericUpDown4, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.NumericUpDown3, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.NumericUpDown2, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).EndInit()
Me.GroupBox5.ResumeLayout(False)
Me.GroupBox5.PerformLayout()
Me.GroupBox3.ResumeLayout(False)
Me.GroupBox4.ResumeLayout(False)
Me.ResumeLayout(False)

End Sub
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents GroupBox5 As System.Windows.Forms.GroupBox
Friend WithEvents RadioGif As System.Windows.Forms.RadioButton
Friend WithEvents RadioJpeg As System.Windows.Forms.RadioButton
Friend WithEvents RadioBitMap As System.Windows.Forms.RadioButton
Friend WithEvents RadioTiff As System.Windows.Forms.RadioButton
Friend WithEvents RadioPng As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton4 As System.Windows.Forms.RadioButton
Friend WithEvents Button14 As System.Windows.Forms.Button
Friend WithEvents Button13 As System.Windows.Forms.Button
Friend WithEvents Button12 As System.Windows.Forms.Button
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents NumericUpDown1 As System.Windows.Forms.NumericUpDown
Friend WithEvents Panel1 As System.Windows.Forms.Panel
Friend WithEvents Button15 As System.Windows.Forms.Button
Friend WithEvents NumericUpDown2 As System.Windows.Forms.NumericUpDown
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents NumericUpDown3 As System.Windows.Forms.NumericUpDown
Friend WithEvents Label7 As System.Windows.Forms.Label
Friend WithEvents NumericUpDown4 As System.Windows.Forms.NumericUpDown
Friend WithEvents Label8 As System.Windows.Forms.Label
Friend WithEvents NumericUpDown5 As System.Windows.Forms.NumericUpDown
Friend WithEvents Button17 As System.Windows.Forms.Button
Friend WithEvents Button16 As System.Windows.Forms.Button
Friend WithEvents GroupBox6 As System.Windows.Forms.GroupBox
Friend WithEvents RadioButton8 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton7 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton5 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton6 As System.Windows.Forms.RadioButton
Friend WithEvents Label9 As System.Windows.Forms.Label

#End Region

End Class

 

Option Strict Off

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

Public Class BarCodeSample
Inherits System.Windows.Forms.Form

Public bc1 As DotNetBarcode = New DotNetBarcode(DotNetBarcode.Types.Code39)

Public BarcodePrint1 As BarcodePrint

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
BarcodePrint1 = New BarcodePrint '新規にフォームを作成する。
Call BarcodePrint1.PrintDocument()

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
BarcodePrint1 = New BarcodePrint '新規にフォームを作成する。
Call BarcodePrint1.PrintPreview() 'プレビュー処理

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Panel1.Refresh()
End Sub

Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint

Dim x1 As Single
Dim y1 As Single
Dim x2 As Single
Dim y2 As Single
Dim BarcodeNumber As String
Dim lOffsetX As Single = NumericUpDown3.Value
Dim lOffsetY As Single = NumericUpDown4.Value
x1 = lOffsetX
y1 = lOffsetY
x2 = Me.Panel1.Size.Width - lOffsetX
y2 = Me.Panel1.Size.Height - lOffsetY
BarcodeNumber = Me.BarNumber.Text()

If RadioButton5.Checked = True Then
bc1.Rotate = DotNetBarcode.Rotates.Rotate0
Else
If RadioButton6.Checked = True Then
bc1.Rotate = DotNetBarcode.Rotates.Rotate90
Else
If RadioButton7.Checked = True Then
bc1.Rotate = DotNetBarcode.Rotates.Rotate180
Else
If RadioButton8.Checked = True Then
bc1.Rotate = DotNetBarcode.Rotates.Rotate270
Else
'QRコード用回転角度を指定
bc1.QRRotate = NumericUpDown5.Value
End If
End If
End If
End If

If Me.RadioButton1.Checked = True Then
bc1.Type = DotNetBarcode.Types.Jan13
End If
If Me.RadioButton2.Checked = True Then
bc1.Type = DotNetBarcode.Types.Jan8
End If
If Me.RadioButton3.Checked = True Then
bc1.Type = DotNetBarcode.Types.Code39
End If
If Me.RadioButton4.Checked = True Then
bc1.Type = DotNetBarcode.Types.QRCode
End If
bc1.QRQuitZone = NumericUpDown1.Value
If NumericUpDown2.Value = 0 Then
bc1.WriteBar(BarcodeNumber, x1, y1, x2, y2, e.Graphics)
Else
bc1.QRWriteBar(BarcodeNumber, x1, y1, NumericUpDown2.Value, e.Graphics)
End If

End Sub

Private Sub Panel1_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Panel1.SizeChanged
Panel1.Refresh()
End Sub

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
NumericUpDown2.Value = 0 'QRCodeのPixel数を0にする。
Panel1.Refresh()
End Sub

Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
NumericUpDown2.Value = 0 'QRCodeのPixel数を0にする。
Panel1.Refresh()
End Sub

Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
NumericUpDown2.Value = 0 'QRCodeのPixel数を0にする。
Panel1.Refresh()
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
ColorDialog1.Color = bc1.BarColor
If (ColorDialog1.ShowDialog() = Windows.Forms.DialogResult.OK) Then
bc1.BarColor = ColorDialog1.Color
End If
Panel1.Refresh()
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
ColorDialog1.Color = bc1.BackGroundColor
If (ColorDialog1.ShowDialog() = Windows.Forms.DialogResult.OK) Then
bc1.BackGroundColor = ColorDialog1.Color
End If
Panel1.Refresh()
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
FontDialog1.ShowColor = True

If (FontDialog1.ShowDialog() = Windows.Forms.DialogResult.OK) Then
bc1.FontColor = FontDialog1.Color
bc1.FontName = FontDialog1.Font.Name
bc1.FontSize = FontDialog1.Font.Size
bc1.FontBold = FontDialog1.Font.Bold
bc1.FontItalic = FontDialog1.Font.Italic
End If
Panel1.Refresh()
End Sub

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If Me.CheckBox1.Checked = True Then
bc1.PrintChar = True
Else
bc1.PrintChar = False
End If
Panel1.Refresh()
End Sub

Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
If Me.CheckBox2.Checked = True Then
bc1.PrintCheckDigitChar = True
Else
bc1.PrintCheckDigitChar = False
End If
Panel1.Refresh()
End Sub

Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged
If Me.CheckBox3.Checked = True Then
bc1.AddChechDigit = True
Else
bc1.AddChechDigit = False
End If
Panel1.Refresh()

End Sub

Private Sub ClickToClipBoard(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click

Dim BarcodeNumber As String
Dim x As Single
Dim y As Single
x = Me.Panel1.Size.Width
y = Me.Panel1.Size.Height
BarcodeNumber = Me.BarNumber.Text()

If NumericUpDown2.Value = 0 Then
bc1.CopyToClipboard(BarcodeNumber, x, y)
Else
bc1.QRCopyToClipboard(BarcodeNumber, NumericUpDown2.Value)
End If

 

End Sub

Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox4.CheckedChanged
If Me.CheckBox4.Checked = True Then
bc1.WriteDebugInfo = True
Else
bc1.WriteDebugInfo = False
End If
Panel1.Refresh()

End Sub

Private Sub PictureBox1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs)
Dim x1 As Single
Dim y1 As Single
Dim x2 As Single
Dim y2 As Single
Dim BarcodeNumber As String
x1 = 0
y1 = 0
x2 = Me.Panel1.Size.Width
y2 = Me.Panel1.Size.Height
BarcodeNumber = Me.BarNumber.Text()
If Me.RadioButton1.Checked = True Then
bc1.Type = DotNetBarcode.Types.Jan13
End If
If Me.RadioButton2.Checked = True Then
bc1.Type = DotNetBarcode.Types.Jan8
End If
If Me.RadioButton3.Checked = True Then
bc1.Type = DotNetBarcode.Types.Code39
End If
bc1.WriteBar(BarcodeNumber, x1, y1, x2, y2, e.Graphics)

End Sub

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
ColorDialog1.Color = bc1.DebugInfoOddColor
If (ColorDialog1.ShowDialog() = Windows.Forms.DialogResult.OK) Then
bc1.DebugInfoOddColor = ColorDialog1.Color
End If
Panel1.Refresh()
End Sub

Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
ColorDialog1.Color = bc1.DebugInfoEvenColor
If (ColorDialog1.ShowDialog() = Windows.Forms.DialogResult.OK) Then
bc1.DebugInfoEvenColor = ColorDialog1.Color
End If
Panel1.Refresh()
End Sub

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
ColorDialog1.Color = bc1.DebugInfoLastColor
If (ColorDialog1.ShowDialog() = Windows.Forms.DialogResult.OK) Then
bc1.DebugInfoLastColor = ColorDialog1.Color
End If
Panel1.Refresh()
End Sub

Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click

Dim myFileName As String = ""

With SaveFileDialog1 'ファイル名を尋ねる。
.RestoreDirectory = True
.OverwritePrompt = True
.FilterIndex = 1
.FileName = ""

If RadioBitMap.Checked = True Then
.Filter = "ビットマップ・ファイル(*.bmp)|*.bmp|すべてのファイル(*.*)|*.*"
bc1.SaveFileType = DotNetBarcode.SaveFileTypes.BitMap
End If
If RadioJpeg.Checked = True Then
.Filter = "JPEG(*.jpg)|*.jpg|すべてのファイル(*.*)|*.*"
bc1.SaveFileType = DotNetBarcode.SaveFileTypes.Jpeg
End If
If RadioGif.Checked = True Then
.Filter = "GIF(*.gif)|*.gif|すべてのファイル(*.*)|*.*"
bc1.SaveFileType = DotNetBarcode.SaveFileTypes.Gif
End If
If RadioPng.Checked = True Then
.Filter = "PNG(*.png)|*.png|すべてのファイル(*.*)|*.*"
bc1.SaveFileType = DotNetBarcode.SaveFileTypes.Png
End If
If RadioTiff.Checked = True Then
.Filter = "TIFF(*.tiff)|*.tiff|すべてのファイル(*.*)|*.*"
bc1.SaveFileType = DotNetBarcode.SaveFileTypes.Gif
End If

If .ShowDialog = Windows.Forms.DialogResult.OK Then
myFileName = .FileName
Dim BarcodeNumber As String
Dim x As Single
Dim y As Single
x = Me.Panel1.Size.Width
y = Me.Panel1.Size.Height
BarcodeNumber = Me.BarNumber.Text()

If NumericUpDown2.Value = 0 Then
bc1.Save(BarcodeNumber, myFileName, x, y)
Else
bc1.QRSave(BarcodeNumber, myFileName, NumericUpDown2.Value)
End If

End If
End With

End Sub

Private Sub BarNumber_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BarNumber.TextChanged
Panel1.Refresh()
End Sub

Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
ColorDialog1.Color = bc1.BarColor
If (ColorDialog1.ShowDialog() = Windows.Forms.DialogResult.OK) Then
bc1.QRColorBigMark = ColorDialog1.Color
End If
Panel1.Refresh()
End Sub

Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
ColorDialog1.Color = bc1.BarColor
If (ColorDialog1.ShowDialog() = Windows.Forms.DialogResult.OK) Then
bc1.QRBackColorBigMark = ColorDialog1.Color
End If
Panel1.Refresh()
End Sub

Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
ColorDialog1.Color = bc1.BarColor
If (ColorDialog1.ShowDialog() = Windows.Forms.DialogResult.OK) Then
bc1.QRColorSmallMark = ColorDialog1.Color
End If
Panel1.Refresh()
End Sub

Private Sub NumericUpDown1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown1.ValueChanged
Panel1.Refresh()
End Sub

Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
ColorDialog1.Color = bc1.QRColorQuitZone
If (ColorDialog1.ShowDialog() = Windows.Forms.DialogResult.OK) Then
bc1.QRColorQuitZone = ColorDialog1.Color
End If
Panel1.Refresh()

End Sub

Private Sub NumericUpDown2_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown2.ValueChanged
If NumericUpDown2.Value >= 1 Then
RadioButton4.Checked = True 'バーコードタイプをQRCodeにセット
End If
Panel1.Refresh()

End Sub

Private Sub NumericUpDown3_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown3.ValueChanged
Panel1.Refresh()

End Sub

Private Sub NumericUpDown4_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown4.ValueChanged
Panel1.Refresh()

End Sub

Private Sub NumericUpDown5_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown5.ValueChanged
RadioButton5.Checked = False
RadioButton6.Checked = False
RadioButton7.Checked = False
RadioButton8.Checked = False
Panel1.Refresh()

End Sub

Private Sub GroupBox2_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox2.Enter

End Sub

Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
Dim OpenFileDialog1 As OpenFileDialog = New OpenFileDialog
OpenFileDialog1.Filter = "イメージファイル(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.JPEG;*.GIF"

If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
bc1.QRBackGroundFileName = OpenFileDialog1.FileName
End If
Panel1.Refresh()
End Sub

Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click
bc1.QRBackGroundFileName = ""
Panel1.Refresh()

End Sub

Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton5.CheckedChanged
Panel1.Refresh()

End Sub

Private Sub RadioButton6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton6.CheckedChanged
Panel1.Refresh()

End Sub

Private Sub RadioButton7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton7.CheckedChanged
Panel1.Refresh()

End Sub

Private Sub RadioButton8_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton8.CheckedChanged
Panel1.Refresh()

End Sub
End Class

Public Class BarcodePrint

'***********************************************************************
' BarcodePrint
'
' 仕様:
'
'
'
'
'
'
'
'***********************************************************************

'***********************************************************************
' 変更記録
' ??/??/?? @001 クラスを独立させた。
'***********************************************************************

Public Sub PrintPreview()
'プリントのプレビュー処理
Try
Dim pd As PrintDocument2 = New PrintDocument2
Dim dlg As New PrintPreviewDialog
dlg.Document = pd
dlg.ShowDialog()
Catch ex As Exception
MessageBox.Show("プリントプレビュー中にエラーが発生しました - " + ex.Message)
End Try
End Sub

 

Public Function PrintRoutineProcess(ByVal ev As PrintPageEventArgs) As Boolean
'*****************************************************************
'戻りコードの意味
'
' True:追加ページあり
' False:追加ページなし
'
'*****************************************************************

Dim barcode1 As DotNetBarcode = New DotNetBarcode 'バーコードクラスを作る。
Dim barcode2 As DotNetBarcode = New DotNetBarcode(DotNetBarcode.Types.Code39) 'バーコードクラスを作る。
Dim x0s As Single 'trans_unit用の座標データを入れるワーク
Dim x0e As Single 'trans_unit用の座標データを入れるワーク
Dim y0s As Single 'trans_unit用の座標データを入れるワーク
Dim y0e As Single 'trans_unit用の座標データを入れるワーク
Dim NO As String
x0s = 80
y0s = 620
x0e = 195
y0e = 55
Dim BarSize As Single
Dim BarX As Single
Dim BarY As Single
BarSize = 150
BarX = 39
BarY = 78

 

'===================================================================
'二次元バーコードの表示
'===================================================================

NO = "DotNetBarcode"
barcode1.BarColor = Color.Black
barcode1.Type = DotNetBarcode.Types.QRCode
barcode1.BarColor = Color.Black
barcode1.BackGroundColor = Color.White
barcode1.QRColorBigMark1 = Color.Red
barcode1.QRColorBigMark2 = Color.Blue
barcode1.QRColorBigMark3 = Color.Green
barcode1.WriteBar(NO, BarX, BarY, BarSize, BarSize, ev.Graphics)
barcode1.BarColor = Color.Green
barcode1.BackGroundColor = Color.White
barcode1.WriteBar(NO, BarX + BarSize * 1.2, BarY, BarSize / 1.5, BarSize / 1.5, ev.Graphics)
barcode1.BarColor = Color.Blue
barcode1.WriteBar(NO, BarX + BarSize * 1.2 + BarSize * 0.8, BarY, BarSize / 1.5 / 1.5, BarSize / 1.5 / 1.5, ev.Graphics)
barcode1.BarColor = Color.Black
barcode1.WriteBar(NO, BarX + BarSize * 1.2 + BarSize * 0.8 + BarSize * 0.6, BarY, BarSize / 1.5 / 1.5 / 1.5, BarSize / 1.5 / 1.5 / 1.5, ev.Graphics)
barcode1.WriteBar(NO, BarX + BarSize * 1.2 + BarSize * 0.8 + BarSize * 0.6 + BarSize * 0.4, BarY, BarSize / 1.5 / 1.5 / 1.5 / 1.5, BarSize / 1.5 / 1.5 / 1.5 / 1.5, ev.Graphics)
NO = "DotNetBarcodeは非常に強力なバーコードライブラリーです。特にVersion2.2.0なってからQRCodeに対応したため、非常に幅広い用途に使用できるようになりました。さらに、DotNetBarcodeは完全無料で自由に利用できます。"
barcode1.BarColor = Color.Black
barcode1.Type = DotNetBarcode.Types.QRCode
barcode1.BarColor = Color.Red
barcode1.BackGroundColor = Color.Yellow
barcode1.WriteBar(NO, BarX, BarY + BarSize * 1.4, BarSize * 2, BarSize * 2, ev.Graphics)
'barcode1.BarColor = Color.Cyan
'barcode1.BackGroundColor = Color.White
barcode1.BarColor = Color.DarkGray
barcode1.BackGroundColor = Color.White
barcode1.QRColorBigMark1 = Color.Red
barcode1.QRColorBigMark2 = Color.Blue
barcode1.QRColorBigMark3 = Color.Green
barcode1.QRColorSmallMark = Color.Pink

barcode1.WriteBar(NO, BarX + BarSize * 2.1, BarY + BarSize * 1.4, BarSize * 2 / 1.5, BarSize * 2 / 1.5, ev.Graphics)
barcode1.BarColor = Color.Brown
barcode1.WriteBar(NO, BarX + BarSize * 2.1 + BarSize * 1.3, BarY + BarSize * 1.4, BarSize * 2 / 1.5 / 1.5, BarSize * 2 / 1.5 / 1.5, ev.Graphics)
barcode1.BarColor = Color.Black
barcode1.WriteBar(NO, BarX + BarSize * 2.1 + BarSize * 1.3 + BarSize * 1, BarY + BarSize * 1.4, BarSize * 2 / 1.5 / 1.5 / 1.5, BarSize * 2 / 1.5 / 1.5 / 1.5, ev.Graphics)

'===================================================================
'一次元バーコードの表示
'===================================================================
barcode1.PrintCheckDigitChar = True
'===================================================================
'===================================================================
barcode1.FontBackGroundColor = Color.LightBlue
'===================================================================
'===================================================================
barcode1.AddChechDigit = True
'===================================================================

y0s = y0s
NO = "3458725" '7桁
'===================================================================
barcode1.BackGroundColor = Color.GreenYellow
barcode1.BarColor = Color.Blue
'===================================================================
barcode1.Type = DotNetBarcode.Types.Jan13
barcode1.WriteBar(NO, x0s, y0s, x0e, y0e, ev.Graphics)
y0s = y0s + 78
barcode1.Type = DotNetBarcode.Types.Jan8
barcode1.WriteBar(NO, x0s, y0s, x0e, y0e, ev.Graphics)
y0s = y0s + 78
barcode1.Type = DotNetBarcode.Types.Code39
barcode1.WriteBar(NO, x0s, y0s, x0e, y0e, ev.Graphics)

'===================================================================
barcode1.BackGroundColor = Color.White
barcode1.BarColor = Color.Red
'===================================================================
barcode1.FontColor = Color.Red
'===================================================================
'===================================================================
barcode1.FontBackGroundColor = Color.Yellow
'===================================================================
y0s = y0s + 100
NO = "34587257" '8桁
barcode1.Type = DotNetBarcode.Types.Jan13
barcode1.WriteBar(NO, x0s, y0s, x0e, y0e, ev.Graphics)
y0s = y0s + 78
barcode1.Type = DotNetBarcode.Types.Jan8
barcode1.WriteBar(NO, x0s, y0s, x0e, y0e, ev.Graphics)
y0s = y0s + 78
barcode1.Type = DotNetBarcode.Types.Code39
barcode1.WriteBar(NO, x0s, y0s, x0e, y0e, ev.Graphics)

'===================================================================
'右の列
'===================================================================
x0s = 450
y0s = 620
x0e = 195
y0e = 55

'===================================================================
barcode1.FontSize = 17
barcode1.FontColor = Color.Blue
'===================================================================
'===================================================================
barcode1.BackGroundColor = Color.Pink
barcode1.BarColor = Color.Blue
'===================================================================
y0s = y0s
NO = "47826457315472154" '17桁
barcode1.Type = DotNetBarcode.Types.Jan13
barcode1.WriteBar(NO, x0s, y0s, x0e, y0e, ev.Graphics)
y0s = y0s + 78
barcode1.Type = DotNetBarcode.Types.Jan8
barcode1.WriteBar(NO, x0s, y0s, x0e, y0e, ev.Graphics)
y0s = y0s + 78
barcode1.Type = DotNetBarcode.Types.Code39
barcode1.WriteBar(NO, x0s, y0s, x0e, y0e, ev.Graphics)

'===================================================================
barcode1.FontName = "Arial"
barcode1.FontSize = 10
barcode1.FontBackGroundColor = Color.White
'===================================================================
barcode1.BackGroundColor = Color.White
barcode1.BarColor = Color.Black
'===================================================================
'===================================================================
y0s = y0s + 100
NO = "345824157865241578945231" '24桁
barcode1.BarColor = Color.Green
barcode1.Type = DotNetBarcode.Types.Jan13
barcode1.WriteBar(NO, x0s, y0s, x0e, y0e, ev.Graphics)
y0s = y0s + 78
barcode1.Type = DotNetBarcode.Types.Jan8
barcode1.WriteBar(NO, x0s, y0s, x0e, y0e, ev.Graphics)
y0s = y0s + 78
barcode1.Type = DotNetBarcode.Types.Code39
barcode1.WriteBar(NO, x0s, y0s, x0e, y0e, ev.Graphics)

End Function

 

Sub PrintDocument()
Try
Dim pd As PrintDocument2 = New PrintDocument2
Dim dlg As New PrintDialog
dlg.Document = pd
dlg.AllowPrintToFile = False '印刷内容をファイルに落とす。
dlg.AllowSelection = False '選択範囲を印刷する。
dlg.AllowSomePages = True '印刷ページの選択を可能にする。
Dim result As DialogResult = dlg.ShowDialog()
If (result = System.Windows.Forms.DialogResult.OK) Then
pd.Print()
Else
Call BarcodePrint1.PrintPreview() 'プレビュー処理
End If
Catch ex As Exception
MessageBox.Show("プリント中にエラーが発生しました - " + ex.Message)
End Try

End Sub

End Class

Public Class PrintDocument2
'***********************************************************************
'
' 仕様:
'
'
'
'
'
'
'
'***********************************************************************

'***********************************************************************
' 変更記録
'
'***********************************************************************

Inherits PrintDocument

Protected Overrides Sub OnPrintPage(ByVal ev As PrintPageEventArgs)

MyBase.OnPrintPage(ev)

If BarcodePrint1.PrintRoutineProcess(ev) = True Then
ev.HasMorePages = True
Else
ev.HasMorePages = False
End If

End Sub

End Class

Module SampleModule1

Public BarcodePrint1 As BarcodePrint = New BarcodePrint

End Module