Code128 のバーコードの画像を生成するには CodePlex の Zen.Barcode.Rendering.Framework を使うと簡単です。
- Visual Basic でフォームアプリケーションを作成
- フォームに TextBox と Button と PictureBox を配置
- メニューの「プロジェクト」→「Nuget パッケージの管理」を選択して、「参照」タブを開いて「Zen.barcode.rendering.framework」を検索してインストール
- 次のようなコードでバーコード画像をピクチャーボックスへ出力
Imports Zen.Barcode Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click If TextBox1.TextLength > 0 Then Dim maxheight As Integer = 40 Dim barcode128 As Code128BarcodeDraw = BarcodeDrawFactory.Code128WithChecksum Dim img As Image = barcode128.Draw(TextBox1.Text, maxheight) PictureBox1.Image = img End If End Sub End Class
参考サイト: https://stackoverflow.com/questions/35054358/how-to-use-barcode-rendering-framework-codeplex