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

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


 

 

【関連リンク】
【WEB単位変換】長さ・面積・体積・容量・重さ・SI接頭語の単位を変換
Webで色(RGB,HSL,CMYK,HSV)の作成・変換・生成・合成
High-speed real-time Web online Color(RGB,HSL,CMYK,HSV)Converter
QRコードの仕組み/作り方 、 ColorfulQRCodeMaker 、  多機能QR 、DotNetBarcode 、 RealTimeQRCodeMaker
3D物理シミュレーション 、 TechPlaza  、  ・ソニックブーム 、DotNetBarcode筆者のページ 、QRCodeBlog1 
コッホ雪片を描く(Silverlight) 、フラクタル(Fractale)を描く 、 フーリエ級数のデモ 、フーリエ級数
西光寺 西光寺 西光寺 西光寺 西光寺 西光寺 西光寺