NSDCode25 メンバ

CODE25(Code 2 of 5, Standard 2 of 5 , Industrial 2 of 5)のバーコードを出力します。


●表現可能なキャラクタ

すべて半角数字です。


●コンストラクタ

名前 説明
NSDCode25 NSDCode25を初期化します。

●プロパティの一覧

名前 説明
PicBox ピクチャーボックスを設定します。
DATAINFO 描画情報の設定をします。
GUnit Print関数で指定するX座標,Y座標の単位を設定します。

●メソッドの一覧

名前 引数 戻り値 説明
Dispose なし なし リソースの解放を行います。
SetPicBoxBitmap ( [Integer], [Integer] ) Boolean型 ビットマップの幅、高さを指定しビットマップをセットします。
( Bitmap ) Boolean型 セットするビットマップを指定し、ビットマップをセットします。
GetCheckDegit ( String , NSD_CODE25_CHECKDEGIT_STYLE ) String型 チェックデジットを返します。
Print ( Single, Single, String ) Boolean型 画面にバーコードを出力します。
( Single, Single, String , Bitmap ) Boolean型 指定したビットマップにバーコードを出力します。
( Single, Single, String , PrintPageEventArgs ) Boolean型 プリンターにバーコードを出力します。

●データ用クラスの一覧

名前:NSD_CODE25_INFO

構文:

Public Class NSD_CODE25_INFO
    Public Sng_Height As Single
    Public Bln_HeightReCalculation As Boolean
    Public Int_Standard_Width As NSDBarcode.NSD_STANDARD_WIDTH
    Public Sng_AllWidth As Single
    Public Sng_NWRatio As Single
    Public Sng_NarrowLineWidth As Single
    Public Int_IntercharacterGap As Integer
    Public Bln_QuietZone As Boolean
    Public Bln_QuietZonePrint As Boolean
    Public QuiteZoneColor As System.Drawing.Color
    Public Bln_SourceCodePrint As Boolean
    Public Int_PrintNoStyle As NSD_CODE25_PRINT_SOURCECODE_STYLE
    Public Int_SourceCodePrint_HoseiY As Integer
    Public Cls_Font As Font
    Public Int_SourceCodePrint_WidthStyle As NSD_CODE25_PRINT_SOURCECODE_WIDTH_STYLE
    Public Int_CheckDegit As NSD_CODE25_CHECKDEGIT_STYLE
    Public Int_OneBarLineHoseiX As Integer
End Class

内容:描画情報用クラス。

名前 説明
Sng_Height Single 高さ(mm)。 (既定値:5)
Bln_HeightReCalculation Boolean 高さの再計算指定。
True :バーコードの高さを計算します。(既定値)
(Sng_Heightが最低の高さになります。)
False:バーコードの高さはSng_Heightで指定します。
Int_Standard_Width NSDBarcode.NSD_STANDARD_WIDTH 幅の基準。 (既定値:NSDBarcode.NSD_STANDARD_WIDTH.NARROW_WIDTH)
Sng_AllWidth Single 全体幅(mm)。 (既定値:100)
Int_Standard_WidthがNSDBarcode.NSD_STANDARD_WIDTH.ALL_WIDTHの時に反映されます。
Sng_NWRatio Single Narrow(細)とWide(太)の比率(2〜3)。 (既定値:2.2)
Sng_NarrowLineWidth Single 細線の幅(mm)。 (既定値:0.2)
Int_Standard_WidthがNSDBarcode.NSD_STANDARD_WIDTH.NARROW_WIDTHの時に反映されます。
Int_IntercharacterGap Integer キャラクタ間ギャップの補正値。 (既定値:1)
Bln_QuietZone Boolean クワイエットゾーンの追加有無。
True :追加します。(既定値)
False:追加しません。
Bln_QuietZonePrint Boolean クワイエットゾーンの描画有無。
True :描画します。
False:描画しません。(既定値)
クワイエットゾーンの描画は範囲確認用(テスト用)で使用します。
実際の本番データを描画する場合は必ずFalseで行います。
QuiteZoneColor System.Drawing.Color クワイエットゾーンも含めた全体枠の描画色。 (既定値:Color.Blue)
Bln_SourceCodePrint Boolean コード文字の出力有無。
True :出力します。(既定値)
False:出力しません。
Int_PrintNoStyle NSD_CODE25_PRINT_SOURCECODE_STYLE コード文字の出力位置。 (既定値:NSD_CODE25_PRINT_SOURCECODE_STYLE.Barcode_Under)
Int_SourceCodePrint_HoseiY Integer コード文字出力時の補正値Y。 (既定値:1)
Cls_Font Font コード文字出力時のフォント。 (既定値:システムのフォント、フォントサイズ 8.25)
Int_SourceCodePrint_WidthStyle NSD_CODE25_PRINT_SOURCECODE_WIDTH_STYLE コード文字を出力する時の幅スタイル。 (既定値:NSD_CODE25_PRINT_SOURCECODE_WIDTH_STYLE.Normal)
Int_CheckDegit NSD_CODE25_CHECKDEGIT_STYLE チェックデジットのスタイル。(既定値:NSD_CODE25_CHECKDEGIT_STYLE.STYLE_NOTHING)
Int_OneBarLineHoseiX Integer 1ライン描画後の補正値。 (既定値:0)

※ここで設定した高さ、細線の幅について出力時には最も近い数字(切り上げ)で丸められます。
全体幅については、出力時に幅を超えない最大の値が自動計算されます。
最も近い数字は出力デバイスの解像度によって変わります。


●定数の一覧

名前:NSD_CODE25_CHECKDEGIT_STYLE チェックデジットスタイル
名前 内容
STYLE_NOTHING なし。
STYLE_7DR セブンチェック(余り)。
STYLE_7DSR セブンチェック(7から余りを引いた数)。
STYLE_9DR ナインチェック(余り)。
STYLE_9DSR ナインチェック(9から余りを引いた数)。
STYLE_MODULUS10W2 モジュラス10/ウェイト2。
STYLE_MODULUS10W3 モジュラス10/ウェイト3。
STYLE_MODULUS11 モジュラス11。

 

名前:NSD_CODE25_PRINT_SOURCECODE_STYLE コード文字を出力するスタイル
名前 内容
Barcode_Top バーコードの上に出力。
Barcode_Under バーコードの下に出力。

 

名前:NSD_CODE25_PRINT_SOURCECODE_WIDTH_STYLE コード文字を出力する時の幅スタイル
名前 内容
Normal 通常。
BarcodeWidth バーコードの幅に合わせます。
BarcodeWidth_FontSizeAuto フォントサイズを自動調整してバーコードの幅に合わせます。

●NSDCode25コンストラクタの説明

構文:Public Sub New()

使用法:Dim Cls_Barcode25 As New NSDCode25

引数:なし。

使用例:

Public Class Form1
    Dim Cls_Barcode25 As New NSDCode25
        :
End Class

●NSDCode25プロパティの説明

名前:PicBox

構文:Public Property PicBox() As PictureBox

機能:ピクチャーボックスを設定します。

Set値:ピクチャーボックスをセットします。

Get値:ピクチャーボックスを取得します。

使用例:

Public Class Form1
    Dim Cls_Barcode25 As NSDCode25 = Nothing
    Dim Cls_CODE25_INFO As NSDCode25.NSD_CODE25_INFO = Nothing

    Private Sub Form1_Load( sender As System.Object, _
                            e As System.EventArgs _
                           ) Handles MyBase.Load
            :
        Cls_Barcode25 = New NSDCode25
        Cls_Barcode25.PicBox = Me.PictureBox1
        Cls_CODE25_INFO = New NSDCode25.NSD_CODE25_INFO
            :
    End Sub

    Private Sub Form1_FormClosed( sender As Object, _
                                  e As System.Windows.Forms.FormClosedEventArgs _
                                 ) Handles Me.FormClosed
        If Not (Cls_Barcode25 Is Nothing) Then
            Cls_Barcode25.Dispose()
            Cls_Barcode25 = Nothing
        End If
        Cls_CODE25_INFO = Nothing
    End Sub
End Class

 

名前:DATAINFO

構文:Public Property DATAINFO() As NSD_CODE25_INFO

機能:描画情報の設定をします。

Set値:描画情報をセットします。

Get値:描画情報を取得します。

使用例:

Public Class Form1
    Dim Cls_Barcode25 As NSDCode25 = Nothing
    Dim Cls_CODE25_INFO As NSDCode25.NSD_CODE25_INFO = Nothing

    Private Sub Form1_Load( sender As System.Object, _
                            e As System.EventArgs _
                           ) Handles MyBase.Load
            :
        Cls_Barcode25 = New NSDCode25
        Cls_Barcode25.PicBox = Me.PictureBox1
        Cls_CODE25_INFO = New NSDCode25.NSD_CODE25_INFO
            :
    End Sub

    Private Sub Button1_Click( sender As System.Object, _
                               e As System.EventArgs _
                              ) Handles Button1.Click
        Cls_CODE25_INFO.Bln_QuietZone = True
        Cls_Barcode25.DATAINFO = Cls_CODE25_INFO
        Cls_Barcode25.SetPicBoxBitmap()
        Cls_Barcode25.Print( 10, 10, "0123456789")
    End Sub

    Private Sub Form1_FormClosed( sender As Object, _
                                  e As System.Windows.Forms.FormClosedEventArgs _
                                 ) Handles Me.FormClosed
        If Not (Cls_Barcode25 Is Nothing) Then
            Cls_Barcode25.Dispose()
            Cls_Barcode25 = Nothing
        End If
        Cls_CODE25_INFO = Nothing
    End Sub
End Class

 

名前:GUnit

構文:Public Property GUnit() As NSDBarcode.NSD_GRAPHICS_UNIT

機能:Print関数で指定するX座標,Y座標の単位を設定します。

Set値:座標の単位をセットします。

Get値:座標の単位を取得します。

使用例:

Public Class Form1
    Dim Cls_Barcode25 As NSDCode25 = Nothing
    Dim Cls_CODE25_INFO As NSDCode25.NSD_CODE25_INFO = Nothing

    Private Sub Form1_Load( sender As System.Object, _
                            e As System.EventArgs _
                           ) Handles MyBase.Load
            :
        Cls_Barcode25 = New NSDCode25
        Cls_Barcode25.PicBox = Me.PictureBox1
        Cls_CODE25_INFO = New NSDCode25.NSD_CODE25_INFO
            :
    End Sub

    Private Sub Button1_Click( sender As System.Object, _
                               e As System.EventArgs _
                              ) Handles Button1.Click
        Cls_CODE25_INFO.Bln_QuietZone = True
        Cls_Barcode25.DATAINFO = Cls_CODE25_INFO
        Cls_Barcode25.SetPicBoxBitmap()
        Cls_Barcode25.GUnit = NSDBarcode.NSD_GRAPHICS_UNIT.Millimeter
        Cls_Barcode25.Print( 10, 10, "0123456789")
    End Sub

    Private Sub Form1_FormClosed( sender As Object, _
                                  e As System.Windows.Forms.FormClosedEventArgs _
                                 ) Handles Me.FormClosed
        If Not (Cls_Barcode25 Is Nothing) Then
            Cls_Barcode25.Dispose()
            Cls_Barcode25 = Nothing
        End If
        Cls_CODE25_INFO = Nothing
    End Sub
End Class

●NSDCode25メソッドの説明

名前:Dispose
構文:Public Overridable Sub Dispose() Implements IDisposable.Dispose

機能:リソースを解放します。

※終了時に必ず呼び出します。

引数:なし。

戻り値:なし。

使用例:

Public Class Form1
    Dim Cls_Barcode25 As NSDCode25 = Nothing
    Dim Cls_CODE25_INFO As NSDCode25.NSD_CODE25_INFO = Nothing

    Private Sub Form1_Load( sender As System.Object, _
                            e As System.EventArgs _
                           ) Handles MyBase.Load
            :
        Cls_Barcode25 = New NSDCodabar
        Cls_Barcode25.PicBox = Me.PictureBox1
        Cls_CODE25_INFO = New NSDCode25.NSD_CODE25_INFO
            :
    End Sub

    Private Sub Form1_FormClosed( sender As Object, _
                                  e As System.Windows.Forms.FormClosedEventArgs _
                                 ) Handles Me.FormClosed
        If Not (Cls_Barcode25 Is Nothing) Then
            Cls_Barcode25.Dispose()
            Cls_Barcode25 = Nothing
        End If
        Cls_CODE25_INFO = Nothing
    End Sub
End Class

 

名前:SetPicBoxBitmap
機能:ビットマップをセットします。

@ビットマップの幅、高さを指定しビットマップをセットします。

構文:Public Overloads Function SetPicBoxBitmap( [Width] , [Height] ) As Boolean

引数:

名前 引数渡しの方法 説明
[Width] Integer 値渡し(ByVal) ビットマップの幅を渡します。(既定値:0)
0または指定なしの場合は、ピクチャーボックスの幅が用いられます。
[Height] Integer 値渡し(ByVal) ビットマップの高さを渡します。(既定値:0)
0または指定なしの場合は、ピクチャーボックスの高さが用いられます。

戻り値:Boolean

戻り値の説明:

True:成功 、 False:失敗、エラー発生

使用例:

Public Class Form1
    Dim Cls_Barcode25 As NSDCode25 = Nothing
    Dim Cls_CODE25_INFO As NSDCode25.NSD_CODE25_INFO = Nothing

    Private Sub Form1_Load( sender As System.Object, _
                            e As System.EventArgs _
                           ) Handles MyBase.Load
            :
        Cls_Barcode25 = New NSDCode25
        Cls_Barcode25.PicBox = Me.PictureBox1
        Cls_CODE25_INFO = New NSDCode25.NSD_CODE25_INFO
            :
    End Sub

    Private Sub Button1_Click( sender As System.Object, _
                               e As System.EventArgs _
                              ) Handles Button1.Click
        Cls_CODE25_INFO.Bln_QuietZone = True
        Cls_Barcode25.DATAINFO = Cls_CODE25_INFO
        Cls_Barcode25.SetPicBoxBitmap()
        Cls_Barcode25.Print( 10, 10, "0123456789")
    End Sub

    Private Sub Form1_FormClosed( sender As Object, _
                                  e As System.Windows.Forms.FormClosedEventArgs _
                                 ) Handles Me.FormClosed
        If Not (Cls_Barcode25 Is Nothing) Then
            Cls_Barcode25.Dispose()
            Cls_Barcode25 = Nothing
        End If
        Cls_CODE25_INFO = Nothing
    End Sub
End Class

 

Aセットするビットマップを指定し、ビットマップをセットします。

構文:Public Overloads Function SetPicBoxBitmap( Bmp ) As Boolean

引数:

名前 引数渡しの方法 説明
Bmp Bitmp 参照渡し(ByRef) セットするビットマップを渡します。

戻り値:Boolean

戻り値の説明:

True:成功 、 False:失敗、エラー発生

使用例:

Public Class Form1
    Dim Cls_PicBmp As Bitmap = Nothing
    Dim Cls_Barcode25 As NSDCode25 = Nothing
    Dim Cls_CODE25_INFO As NSDCode25.NSD_CODE25_INFO = Nothing

    Private Sub Form1_Load( sender As System.Object, _
                            e As System.EventArgs _
                           ) Handles MyBase.Load
            :
        Cls_Barcode25 = New NSDCode25
        Cls_Barcode25.PicBox = Me.PictureBox1
        Cls_PicBmp = New Bitmap(Me.PictureBox1.Width, Me.PictureBox1.Height)
        Cls_Barcode25.SetPicBoxBitmap(Cls_PicBmp)
        Cls_CODE25_INFO = New NSDCode25.NSD_CODE25_INFO
            :
    End Sub

    Private Sub Button1_Click( sender As System.Object, _
                               e As System.EventArgs _
                              ) Handles Button1.Click
        Cls_CODE25_INFO.Bln_QuietZone = True
        Cls_Barcode25.DATAINFO = Cls_CODE25_INFO
        Cls_Barcode25.Print( 10, 10, "0123456789")
    End Sub

    Private Sub Form1_FormClosed( sender As Object, _
                                  e As System.Windows.Forms.FormClosedEventArgs _
                                 ) Handles Me.FormClosed
        If Not (Cls_Barcode25 Is Nothing) Then
            Cls_Barcode25.Dispose()
            Cls_Barcode25 = Nothing
        End If
        Cls_CODE25_INFO = Nothing

        If Not (Cls_PicBmp Is Nothing) Then
           Cls_PicBmp.Dispose()
           Cls_PicBmp = Nothing
        End If
    End Sub
End Class

 

名前:GetCheckDegit
構文:Public Function GetCheckDegit( Code , Style ) As String

機能:チェックデジットを返します。

引数:

名前 引数渡しの方法 説明
Code String 値渡し(ByVal) チェックデジットなしのコードを渡します。
Style NSD_CODE25_CHECKDEGIT_STYLE 値渡し(ByVal) チェックデジットのスタイルを渡します。

戻り値:String

戻り値の説明:

チェックデジットを返します。

使用例:

Public Class Form1
    Dim Cls_Barcode25 As NSDCode25 = Nothing
    Dim Cls_CODE25_INFO As NSDCode25.NSD_CODE25_INFO = Nothing

    Private Sub Form1_Load( sender As System.Object, _
                            e As System.EventArgs _
                           ) Handles MyBase.Load
            :
        Cls_Barcode25 = New NSDCode25
        Cls_Barcode25.PicBox = Me.PictureBox1
        Cls_Barcode25.SetPicBoxBitmap()
        Cls_CODE25_INFO = New NSDCode25.NSD_CODE25_INFO
            :
    End Sub

    Private Sub Button1_Click( sender As System.Object, _
                               e As System.EventArgs _
                              ) Handles Button1.Click
        Dim Str_Code As String = "0123456789"
        Str_Code &= Cls_Barcode25.GetCheckDegit(Str_Code , _
                                     NSD_CODE25_CHECKDEGIT_STYLE.STYLE_MODULUS10W3)
        Cls_CODE25_INFO.Bln_CheckDegit = False
        Cls_Barcode25.DATAINFO = Cls_CODE25_INFO
        Cls_Barcode25.Print( 10, 10, Str_Code)
    End Sub

    Private Sub Form1_FormClosed( sender As Object, _
                                  e As System.Windows.Forms.FormClosedEventArgs _
                                 ) Handles Me.FormClosed
        If Not (Cls_Barcode25 Is Nothing) Then
            Cls_Barcode25.Dispose()
            Cls_Barcode25 = Nothing
        End If
        Cls_CODE25_INFO = Nothing
    End Sub
End Class

 

名前:Print
機能:バーコードを出力します。

@画面にバーコードを出力します。

構文:Public Function Print( X , Y , Code ) As Boolean

引数:

名前 引数渡しの方法 説明
X Single 値渡し(ByVal) 出力するX座標を渡します。
Y Integer 値渡し(ByVal) 出力するY座標を渡します。
Code String 値渡し(ByVal) 出力するコードを渡します。

戻り値:Boolean

戻り値の説明:

True:成功 、 False:失敗、エラー発生

使用例:

Public Class Form1
    Dim Cls_Barcode25 As NSDCode25 = Nothing
    Dim Cls_CODE25_INFO As NSDCode25.NSD_CODE25_INFO = Nothing

    Private Sub Form1_Load( sender As System.Object, _
                            e As System.EventArgs _
                           ) Handles MyBase.Load
            :
        Cls_Barcode25 = New NSDCode25
        Cls_Barcode25.PicBox = Me.PictureBox1
        Cls_Barcode25.SetPicBoxBitmap()
        Cls_CODE25_INFO = New NSDCode25.NSD_CODE25_INFO
            :
    End Sub

    Private Sub Button1_Click( sender As System.Object, _
                               e As System.EventArgs _
                              ) Handles Button1.Click
        Cls_Barcode25.DATAINFO = Cls_CODE25_INFO
        Cls_Barcode25.Print( 10, 10, "0123456789")
    End Sub

    Private Sub Form1_FormClosed( sender As Object, _
                                  e As System.Windows.Forms.FormClosedEventArgs _
                                 ) Handles Me.FormClosed
        If Not (Cls_Barcode25 Is Nothing) Then
            Cls_Barcode25.Dispose()
            Cls_Barcode25 = Nothing
        End If
        Cls_CODE25_INFO = Nothing
    End Sub
End Class

 

A指定したビットマップにバーコードを出力します。

構文:Public Function Print( X , Y , Code , Bmp ) As Boolean

引数:

名前 引数渡しの方法 説明
X Single 値渡し(ByVal) 出力するX座標を渡します。
Y Integer 値渡し(ByVal) 出力するY座標を渡します。
Code String 値渡し(ByVal) 出力するコードを渡します。
Bmp Bitmp 参照渡し(ByRef) 出力先のビットマップを渡します。

戻り値:Boolean

戻り値の説明:

True:成功 、 False:失敗、エラー発生

使用例:

Public Class Form1
    Dim Cls_PicBmp As Bitmap = Nothing
    Dim Cls_Barcode25 As NSDCode25 = Nothing
    Dim Cls_CODE25_INFO As NSDCode25.NSD_CODE25_INFO = Nothing

    Private Sub Form1_Load( sender As System.Object, _
                            e As System.EventArgs _
                           ) Handles MyBase.Load
            :
        Cls_Barcode25 = New NSDCode25
        Cls_PicBmp = New Bitmap(100, 100)
        Cls_CODE25_INFO = New NSDCode25.NSD_CODE25_INFO
            :
    End Sub

    Private Sub Button1_Click( sender As System.Object, _
                               e As System.EventArgs _
                              ) Handles Button1.Click
        Cls_Barcode25.DATAINFO = Cls_CODE25_INFO
        Cls_Barcode25.Print( 10, 10, "0123456789", Cls_PicBmp)
    End Sub

    Private Sub Form1_FormClosed( sender As Object, _
                                  e As System.Windows.Forms.FormClosedEventArgs _
                                 ) Handles Me.FormClosed
        If Not (Cls_Barcode25 Is Nothing) Then
            Cls_Barcode25.Dispose()
            Cls_Barcode25 = Nothing
        End If
        Cls_CODE25_INFO = Nothing

        If Not (Cls_PicBmp Is Nothing) Then
           Cls_PicBmp.Dispose()
           Cls_PicBmp = Nothing
        End If
    End Sub
End Class

 

Bプリンターにバーコードを出力します。

構文:Public Function Print( X , Y , Code , e ) As Boolean

引数:

名前 引数渡しの方法 説明
X Single 値渡し(ByVal) 出力するX座標を渡します。
Y Integer 値渡し(ByVal) 出力するY座標を渡します。
Code String 値渡し(ByVal) 出力するコードを渡します。
e PrintPageEventArgs 参照渡し(ByRef) PrintPageイベントのSystem.Drawing.Printing.PrintPageEventArgsを渡します。

戻り値:Boolean

戻り値の説明:

True:成功 、 False:失敗、エラー発生

使用例:

Public Class Form1
    Dim Cls_Barcode25 As NSDCode25 = Nothing
    Dim Cls_CODE25_INFO As NSDCode25.NSD_CODE25_INFO = Nothing

    Private Sub Form1_Load( sender As System.Object, _
                            e As System.EventArgs _
                           ) Handles MyBase.Load
            :
        Cls_Barcode25 = New NSDCode25
        Cls_CODE25_INFO = New NSDCode25.NSD_CODE25_INFO
            :
    End Sub

    Private Sub Button1_Click( sender As System.Object, _
                               e As System.EventArgs _
                              ) Handles Button1.Click
        Me.PrintDocument1.Print()
    End Sub

    Private Sub PrintDocument1_PrintPage( ByVal sender As Object, _
                                          ByVal e As System.Drawing.Printing.PrintPageEventArgs _
                                         ) Handles PrintDocument1.PrintPage
        Cls_Barcode25.DATAINFO = Cls_CODE25_INFO
        Cls_Barcode25.Print(10, 10, "0123456789", e)
        e.HasMorePages = False
    End Sub

    Private Sub Form1_FormClosed( sender As Object, _
                                  e As System.Windows.Forms.FormClosedEventArgs _
                                 ) Handles Me.FormClosed
        If Not (Cls_Barcode25 Is Nothing) Then
            Cls_Barcode25.Dispose()
            Cls_Barcode25 = Nothing
        End If
        Cls_CODE25_INFO = Nothing
    End Sub
End Class

Copyright (C) 2013 Nihon System Developer Corp. All Rights Reserved.