無料で高速リアルタイムにQRコードが作成できる
RealTimeQRCodeMakerのソースプログラムのみ

Imports System
Imports System.Windows.Forms
Imports System.Drawing

Public Class MainForm

Dim bc1 As DotNetBarcode = New DotNetBarcode

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
x1 = 0
y1 = 0
x2 = Me.Panel1.Size.Width
y2 = Me.Panel1.Size.Height
BarcodeNumber = Me.TextBox1.Text()

If CheckBox3.Checked = True Then
bc1.QRSetVersion = DotNetBarcode.QRVersions.Automatic
Else
bc1.QRSetVersion = NumericUpDown3.Value
End If

If RadioButton1.Checked = True Then
bc1.QRSetECCRate = DotNetBarcode.QRECCRates.Low7Percent
End If
If RadioButton2.Checked = True Then
bc1.QRSetECCRate = DotNetBarcode.QRECCRates.Medium15Percent
End If
If RadioButton3.Checked = True Then
bc1.QRSetECCRate = DotNetBarcode.QRECCRates.Quality25Percent
End If
If RadioButton4.Checked = True Then
bc1.QRSetECCRate = DotNetBarcode.QRECCRates.HighQuality30Percent
End If

If RadioButton5.Checked = True Then
bc1.QRSetTextType = DotNetBarcode.QRTextTypes.Automatic
End If
If RadioButton6.Checked = True Then
bc1.QRSetTextType = DotNetBarcode.QRTextTypes.Numeric
End If
If RadioButton7.Checked = True Then
bc1.QRSetTextType = DotNetBarcode.QRTextTypes.AlphaNumeric
End If
If RadioButton8.Checked = True Then
bc1.QRSetTextType = DotNetBarcode.QRTextTypes.Kanji
End If
If RadioButton9.Checked = True Then
bc1.QRSetTextType = DotNetBarcode.QRTextTypes.Binary
End If

If CheckBox1.Checked = True Then
bc1.WriteBar(BarcodeNumber, x1, y1, x2, y2, e.Graphics)
Else
bc1.QRWriteBar(BarcodeNumber, x1, y1, NumericUpDown1.Value, e.Graphics)
End If

If BarcodeNumber <> "" And bc1.QRInquireVersion >= DotNetBarcode.QRVersions.Ver01 And bc1.QRInquireVersion <= DotNetBarcode.QRVersions.Ver40 Then
Dim t As Integer
LabelA.Text = "【種類選択】=" + bc1.QRInquireTextType.ToString
LabelB.Text = "【指定Version】=" + bc1.QRSetVersion.ToString
LabelC.Text = "【出力結果Version】=" + bc1.QRInquireVersion.ToString

'色を元に戻す。
LabelD.ForeColor = Color.Black
LabelE.ForeColor = Color.Black
LabelF.ForeColor = Color.Black
LabelG.ForeColor = Color.Black

t = bc1.QRInquireNumericBits
LabelD.Text = "【数字ビット数】=" + t.ToString
If t = 0 Then
LabelD.ForeColor = Color.Gray
End If
If bc1.QRInquireTextType = DotNetBarcode.QRTextTypes.Numeric Then
LabelD.ForeColor = Color.Blue
End If

t = bc1.QRInquireAlphaNumericBits
LabelE.Text = "【英数字ビット数】=" + t.ToString
If t = 0 Then
LabelE.ForeColor = Color.Gray
End If
If bc1.QRInquireTextType = DotNetBarcode.QRTextTypes.AlphaNumeric Then
LabelE.ForeColor = Color.Blue
End If

t = bc1.QRInquireKanjiBits
LabelF.Text = "【漢字ビット数】=" + t.ToString
If t = 0 Then
LabelF.ForeColor = Color.Gray
End If
If bc1.QRInquireTextType = DotNetBarcode.QRTextTypes.Kanji Then
LabelF.ForeColor = Color.Blue
End If

t = bc1.QRInquireBinaryBits
LabelG.Text = "【バイナリビット数】=" + t.ToString
If t = 0 Then
LabelG.ForeColor = Color.Gray
End If
If bc1.QRInquireTextType = DotNetBarcode.QRTextTypes.Binary Then
LabelG.ForeColor = Color.Blue
End If

If bc1.QRInquireModuleSize <> 0 Then
LabelH.Text = "【モジュールサイズ】=" + bc1.QRInquireModuleSize.ToString
End If
Else
ClearOutputLabel()
End If

 

End Sub

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
Label2.Enabled = False
NumericUpDown1.Enabled = False
Else
Label2.Enabled = True
NumericUpDown1.Enabled = True
End If
ReWriteQRCode()
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
bc1.Type = DotNetBarcode.Types.QRCode
ClearOutputLabel()
End Sub

Private Sub ClearOutputLabel()
LabelA.Text = ""
LabelB.Text = ""
LabelC.Text = ""
LabelD.Text = ""
LabelE.Text = ""
LabelF.Text = ""
LabelG.Text = ""
LabelH.Text = ""
LabelI.Text = ""

End Sub

'QRCodeの再描画
Private Sub ReWriteQRCode()
If CheckBox2.Checked = True Then
Panel1.Refresh()
End If
End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
ReWriteQRCode()
End Sub

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

Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
ReWriteQRCode()
End Sub

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

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

End Sub

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

End Sub

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

End Sub

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

End Sub

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

End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
ColorDialog1.Color = bc1.QRColorBigMark3
If (ColorDialog1.ShowDialog() = Windows.Forms.DialogResult.OK) Then
bc1.QRColorBigMark3 = ColorDialog1.Color
End If
ReWriteQRCode()

End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
ColorDialog1.Color = bc1.QRColorBigMarkBorder1
If (ColorDialog1.ShowDialog() = Windows.Forms.DialogResult.OK) Then
bc1.QRColorBigMarkBorder = ColorDialog1.Color
End If
ReWriteQRCode()

End Sub

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

End Sub

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

End Sub

Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
If CheckBox2.Checked = True Then
Button11.Enabled = False
ReWriteQRCode()
Else
Button11.Enabled = True
End If
End Sub

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

End Sub

Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.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.TextBox1.Text()
If CheckBox1.Checked = True Then
bc1.CopyToClipboard(BarcodeNumber, x, y)
Else
bc1.QRCopyToClipboard(BarcodeNumber, NumericUpDown1.Value)
End If

End Sub

Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.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 RadioEmf.Checked = True Then
.Filter = "EMF(*.emf)|*.emf|すべてのファイル(*.*)|*.*"
bc1.SaveFileType = DotNetBarcode.SaveFileTypes.Emf
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.TextBox1.Text()
If CheckBox1.Checked = True Then
bc1.Save(BarcodeNumber, myFileName, x, y)
Else
bc1.QRSave(BarcodeNumber, myFileName, NumericUpDown1.Value)
End If

End If
End With

End Sub

Private Sub NumericUpDown2_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown2.ValueChanged
bc1.QRQuitZone = NumericUpDown2.Value
ReWriteQRCode()
End Sub

Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged
If CheckBox3.Checked = True Then
NumericUpDown3.Enabled = False
Else
NumericUpDown3.Enabled = True
End If
ReWriteQRCode()

End Sub

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

End Sub

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

End Sub

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

End Sub

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

End Sub

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

End Sub

Private Sub RadioButton9_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton9.CheckedChanged
ReWriteQRCode()

End Sub

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
ReWriteQRCode()

End Sub

Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
ReWriteQRCode()

End Sub

Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
ReWriteQRCode()

End Sub

Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
ReWriteQRCode()

End Sub
End Class


 

【関連リンク】
【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)を描く 、 フーリエ級数のデモ 、フーリエ級数
西光寺 西光寺 西光寺 西光寺 西光寺 西光寺 西光寺