4.3. IDisplayCommandBuilder

カスタマーディスプレイ制御用コマンドを生成する機能を提供するインターフェイスです。

本インターフェイスは、カスタマーディスプレイに対応しているモデル専用です。 対応しているモデルは 対応外部機器 を参照ください。

  • プロパティ

    名称

    説明

    Commands

    生成、追加されたコマンド列です。

    PassThroughCommands

    生成、追加されたコマンド列の先頭にプリンタへのパススルーコマンドが追加されたコマンド列です。

  • メソッド

    名称

    説明

    Append

    データ(テキストやコマンド)をコマンドバッファに追加します。

    AppendBackSpace

    バックスペースコマンドを生成し、コマンドバッファに追加します。

    AppendHorizontalTab

    水平タブコマンドを生成し、コマンドバッファに追加します。

    AppendLineFeed

    ラインフィードコマンドを生成し、コマンドバッファに追加します。

    AppendCarriageReturn

    キャリッジリターンコマンドを生成し、コマンドバッファに追加します。

    AppendBitmap

    グラフィック表示コマンドを生成し、コマンドバッファに追加します。

    AppendInternational

    国際文字指定コマンドを生成し、コマンドバッファに追加します。

    AppendCodePage

    コードページ指定コマンドを生成し、コマンドバッファに追加します。

    AppendDeleteToEndOfLine

    画面を行末までクリアするコマンドを生成し、コマンドバッファに追加します。

    AppendClearScreen

    画面をクリアするコマンドを生成し、コマンドバッファに追加します。

    AppendHomePosition

    カーソルをホームポジションに移動するコマンドを生成し、コマンドバッファに追加します。

    AppendTurnOn

    バックライトをオン・オフするコマンドを生成し、コマンドバッファに追加します。

    AppendSpecifiedPosition

    カーソルを指定された位置に移動するコマンドを生成し、コマンドバッファに追加します。

    AppendCursorMode

    カーソルモード変更コマンドを生成し、コマンドバッファに追加します。

    AppendContrastMode

    コントラストモード変更コマンドを生成し、コマンドバッファに追加します。

    AppendUserDefinedCharacter

    ユーザー定義文字(SBCS)登録コマンドを生成し、コマンドバッファに追加します。

    AppendUserDefinedDbcsCharacter

    ユーザー定義文字(DBCS)登録コマンドを生成し、コマンドバッファに追加します。

4.3.1. DisplayInternationalType

国際文字指定定数です。

  • 宣言

    public enum DisplayInternationalType {
        USA,
        France,
        Germany,
        UK,
        Denmark,
        Sweden,
        Italy,
        Spain,
        Japan,
        Norway,
        Denmark2,
        Spain2,
        LatinAmerica,
        Korea
    }
    
  • 定数

    名称

    説明

    USA

    アメリカ

    France

    フランス

    Germany

    ドイツ

    UK

    イギリス

    Denmark

    デンマーク

    Sweden

    スウェーデン

    Italy

    イタリア

    Spain

    スペイン

    Japan

    日本

    Norway

    ノルウェー

    Denmark2

    デンマークII

    Spain2

    スペインII

    LatinAmerica

    ラテンアメリカ

    Korea

    韓国

4.3.2. DisplayCodePageType

コードページ指定定数です。

  • 宣言

    public enum DisplayCodePageType {
        CP437,
        Katakana,
        CP850,
        CP860,
        CP863,
        CP865,
        CP1252,
        CP866,
        CP852,
        CP858,
        Japanese,
        SimplifiedChinese,
        TraditionalChinese,
        Hangul
    }
    
  • 定数

    名称

    説明

    CP437

    CodePage437 (USA, Std. Europe)

    Katakana

    Katakana

    CP850

    PC850 (Multilingual)

    CP860

    PC860 (Portuguese)

    CP863

    PC863 (Canadian-French)

    CP865

    PC865 (Norwegian)

    CP1252

    WPC1252

    CP866

    PC866 [Cyrillic #2]

    CP852

    PC852 [Latin 2]

    CP858

    Page 19 [PC858]

    Japanese

    Japanese font (shift JIS)

    SimplifiedChinese

    Simplified Chinese (GB2312)

    TraditionalChinese

    Traditional Chinese (Big5)

    Hangul

    Hangul (KSC5601)

4.3.3. DisplayCursorMode

カーソルモード指定定数です。

  • 宣言

    public enum DisplayCursorMode {
        Off,
        Blink,
        On
    }
    
  • 定数

    名称

    説明

    Off

    カーソル消灯

    Blink

    カーソル点滅

    On

    カーソル点灯

4.3.4. DisplayContrastMode

コントラストモード指定定数です。

  • 宣言

    public enum DisplayContrastMode {
        Minus3,
        Minus2,
        Minus1,
        Default,
        Plus1,
        Plus2,
        Plus3
    }
    
  • 定数

    名称

    説明

    Minus3

    コントラスト マイナス3

    Minus2

    コントラスト マイナス2

    Minus1

    コントラスト マイナス1

    Default

    デフォルト

    Plus1

    コントラスト プラス1

    Plus2

    コントラスト プラス2

    Plus3

    コントラスト プラス3

4.3.5. Commands

コマンドバッファ(生成したコマンド)を取得します。

  • 宣言

    byte[] Commands { get; };
    
  • 引数

    なし

  • 説明

    コマンドバッファ(生成したコマンド)

    byte[]

4.3.6. PassThroughCommands

コマンドバッファ(生成したコマンド)の先頭にプリンタへのパススルーコマンドが追加されたコマンド列を取得します。

  • 宣言

    byte[] PassThroughCommands { get; };
    
  • 引数

    なし

  • 戻り値

    説明

    コマンドバッファ(生成したコマンド)

    byte[]

  • 実装例

    public static byte[] CreateTextPattern()
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
    
        builder.AppendCursorMode(DisplayCursorMode.Off);
    
        builder.AppendHomePosition();
    
        byte[] textPattern = new byte[]{
            0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
            0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
            0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47
        };
    
        builder.Append(textPattern);
    
        return builder.PassThroughCommands;
    }
    

    DisplayFunction.cs / DisplaySamplePage.xaml.cs / DisplayExtSamplePage.xaml.csを参照ください。

4.3.7. Append

データ(テキストやコマンド)をコマンドバッファに追加します。

  • 宣言

    void Append(byte data);
    void Append(byte[] data);
    
  • 引数

    名称

    説明

    data

    データ(テキストやコマンド)

    byte
    byte[]
  • 戻り値

    なし

  • 実装例

    public static byte[] CreateTextPattern()
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
    
        builder.AppendCursorMode(DisplayCursorMode.Off);
    
        builder.AppendHomePosition();
    
        byte[] textPattern = new byte[]{
            0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
            0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
            0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47
        };
    
        builder.Append(textPattern);
    
        return builder.PassThroughCommands;
    }
    

    DisplayFunctions.cs を参照ください。

4.3.8. AppendBackSpace

バックスペースコマンドを生成し、コマンドバッファに追加します。

  • 宣言

    void AppendBackSpace();
    
  • 引数

    なし

  • 戻り値

    なし

4.3.9. AppendHorizontalTab

added in version 1.6.0

水平タブコマンドを生成し、コマンドバッファに追加します。

  • 宣言

    void AppendHorizontalTab();
    
  • 引数

    なし

  • 戻り値

    なし

4.3.10. AppendLineFeed

ラインフィードコマンドを生成し、コマンドバッファに追加します。

  • 宣言

    void AppendLineFeed();
    
  • 引数

    なし

  • 戻り値

    なし

4.3.11. AppendCarriageReturn

キャリッジリターンコマンドを生成し、コマンドバッファに追加します。

  • 宣言

    void AppendCarriageReturn();
    
  • 引数

    なし

  • 戻り値

    なし

4.3.12. AppendBitmap

グラフィック表示コマンドを生成し、コマンドバッファに追加します。

  • 宣言

    void AppendBitmap(Bitmap bitmap, bool diffusion);
    
  • 引数

    名称

    説明

    bitmap

    表示したいイメージ
    横 160dot、縦 40dotのモノクロBitmapクラスのインスタンスを指定してください。
    異なるサイズのBitmapが指定された場合、横 160dot、縦 40dotにリサイズされます。
    Bitmapの各ピクセルの色は自動でモノクロ2値に変換されます。

    System.Drawing.Bitmap

    diffusion

    誤差拡散
    true ... 誤差拡散を行う
    false ... 誤差拡散を行わない

    bool

  • 戻り値

    なし

  • 実装例

    public static byte[] CreateGraphicPattern()
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
    
        Bitmap bitmap;
        using (var stream = Properties.Resources.display_image_1)
        {
            bitmap = new Bitmap(stream);
        }
    
        builder.AppendBitmap(bitmap, false);
    
        return builder.PassThroughCommands;
    }
    

    DisplayFunction.csを参照ください。

4.3.13. AppendInternational

国際文字指定コマンドを生成し、コマンドバッファに追加します。

  • 宣言

    void AppendInternational(DisplayInternationalType internationalType);
    
  • 引数

    名称

    説明

    internationalType

    国際文字指定定数

    DisplayInternationalType

  • 戻り値

    なし

  • 実装例

    public static byte[] CreateCharacterSet(DisplayCodePageType codePageType)
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendHomePosition();
    
        builder.AppendInternational(DisplayInternationalType.USA);
        builder.AppendCodePage(codePageType);
    
        byte[] pattern = {
            0x2d, 0x20, 0x20, 0x20, 0x23, 0x24, 0x40, 0x5b, 0x5c, 0x5d, 0x5e, 0x60, 0x7b, 0x7c, 0x7d, 0x7e, 0x20, 0x20, 0x20, 0x2d,
            0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3
        };
    
        builder.Append(textPattern);
    
        return builder.PassThroughCommands;
    }
    

    DisplayFunction.csを参照ください。

4.3.14. AppendCodePage

コードページ指定コマンドを生成し、コマンドバッファに追加します。

  • 宣言

    void AppendCodePage(DisplayCodePageType codePageType);
    
  • 引数

    名称

    説明

    codePageType

    コードページ指定定数

    DisplayCodePageType

  • 戻り値

    なし

  • 実装例

    public static byte[] CreateCharacterSet(DisplayCodePageType codePageType)
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendHomePosition();
    
        builder.AppendInternational(DisplayInternationalType.USA);
        builder.AppendCodePage(codePageType);
    
        byte[] pattern = {
            0x2d, 0x20, 0x20, 0x20, 0x23, 0x24, 0x40, 0x5b, 0x5c, 0x5d, 0x5e, 0x60, 0x7b, 0x7c, 0x7d, 0x7e, 0x20, 0x20, 0x20, 0x2d,
            0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3
        };
    
        builder.Append(textPattern);
    
        return builder.PassThroughCommands;
    }
    

    DisplayFunction.csを参照ください。

4.3.15. AppendDeleteToEndOfLine

画面を行末までクリアするコマンドを生成し、コマンドバッファに追加します。

  • 宣言

    void AppendDeleteToEndOfLine();
    
  • 引数

    なし

  • 戻り値

    なし

4.3.16. AppendClearScreen

画面をクリアするコマンドを生成し、コマンドバッファに追加します。

  • 宣言

    void AppendClearScreen();
    
  • 引数

    なし

  • 戻り値

    なし

  • 実装例

    public static byte[] CreateClearScreen()
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
    
        return builder.PassThroughCommands;
    }
    

    DisplayFunction.csを参照ください。

4.3.17. AppendHomePosition

カーソルをホームポジションに移動するコマンドを生成し、コマンドバッファに追加します。

  • 宣言

    void AppendHomePosition();
    
  • 引数

    なし

  • 戻り値

    なし

  • 実装例

    public static byte[] CreateCursorMode(DisplayCursorMode mode)
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendHomePosition();
    
        byte[] textPattern = Encoding.UTF8.GetBytes("Star Micronics     Total :    12345");
    
        builder.Append(textPattern);
    
        builder.AppendSpecifiedPosition(20, 2);
    
        builder.AppendCursorMode(mode);
    
        builder.AppendHomePosition();
    
        return builder.PassThroughCommands;
    }
    

    DisplayFunction.csを参照ください。

4.3.18. AppendTurnOn

バックライトをオン・オフするコマンドを生成し、コマンドバッファに追加します。

  • 宣言

    void AppendTurnOn(bool turnOn);
    
  • 引数

    名称

    説明

    turnOn

    バックライトのオン・オフ

    bool

  • 戻り値

    なし

  • 実装例

    public static byte[] CreateTurnOn()
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendTurnOn(true);
    
        return builder.PassThroughCommands;
    }
    

    DisplayFunction.csを参照ください。

4.3.19. AppendSpecifiedPosition

カーソルを指定された位置に移動するコマンドを生成し、コマンドバッファに追加します。

  • 宣言

    void AppendSpecifiedPosition(int x, int y);
    
  • 引数

    名称

    説明

    x

    桁位置(一番左の桁が1)

    int

    y

    行位置(一番上の行が1)

    int

  • 戻り値

    なし

  • 実装例

    public static byte[] CreateCursorMode(DisplayCursorMode mode)
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendHomePosition();
    
        byte[] textPattern = Encoding.UTF8.GetBytes("Star Micronics     Total :    12345");
    
        builder.Append(textPattern);
    
        builder.AppendSpecifiedPosition(20, 2);
    
        builder.AppendCursorMode(mode);
    
        return builder.PassThroughCommands;
    }
    

    DisplayFunction.csを参照ください。

4.3.20. AppendCursorMode

カーソルモード変更コマンドを生成し、コマンドバッファに追加します。

  • 宣言

    void AppendCursorMode(DisplayCursorMode cursorMode);
    
  • 引数

    名称

    説明

    cursorMode

    カーソルモード指定定数

    DisplayCursorMode

  • 戻り値

    なし

  • 実装例

    public static byte[] CreateCursorMode(DisplayCursorMode mode)
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendHomePosition();
    
        byte[] textPattern = Encoding.UTF8.GetBytes("Star Micronics     Total :    12345");
    
        builder.Append(textPattern);
    
        builder.AppendSpecifiedPosition(20, 2);
    
        builder.AppendCursorMode(DisplayCursorMode.On);
    
        return builder.PassThroughCommands;
    }
    

    DisplayFunction.csを参照ください。

4.3.21. AppendContrastMode

コントラストモード変更コマンドを生成し、コマンドバッファに追加します。

  • 宣言

    void AppendContrastMode(DisplayContrastMode contrastMode);
    
  • 引数

    名称

    説明

    contrastMode

    コントラストモード指定定数

    DisplayContrastMode

  • 戻り値

    なし

  • 実装例

    public static byte[] CreateContrastMode()
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendContrastMode(DisplayContrastMode.Default);
    
        return builder.PassThroughCommands;
    }
    

    DisplayFunction.csを参照ください。

4.3.22. AppendUserDefinedCharacter

ユーザー定義文字(SBCS)登録コマンドを生成し、コマンドバッファに追加します。

  • 宣言

    void AppendUserDefinedCharacter(int index, int code, byte[] font);
    
  • 引数

    名称

    説明

    index

    フォント番号
    00h ≦ index ≦ 1Fh

    int

    code

    ユーザー定義文字の文字コード
    20h ≦ code ≦ 7Fh
    AppendCodePage メソッドで Japanese を指定した場合、以下の範囲も使用可能です。
    A0h ≦ code ≦ DFh

    int

    font

    16byteのフォントデータ
    ユーザー定義文字のフォントデータのフォーマットを参照してください。
    null を指定すると、指定したフォント番号のユーザー定義文字を解除します。

    byte[]

  • 戻り値

    なし

  • ユーザー定義文字のフォントデータのフォーマット

    ../_images/display_user_defined_sbcs_data.png
  • 実装例

    public static byte[] CreateUserDefinedCharacter(bool set)
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendHomePosition();
    
        builder.AppendInternational(DisplayInternationalType.USA);
        builder.AppendCodePage(DisplayCodePageType.Japanese);
    
        if (set)
        {
            byte[] font = { 0x00, 0x00, 0x32, 0x00, 0x49, 0x00, 0x49, 0x7f, 0x26, 0x48, 0x00, 0x48, 0x00, 0x30, 0x00, 0x00 };
            byte[] dbcsFont = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x20, 0x04, 0x90, 0x04, 0x90, 0x02, 0x60, 0x00, 0x00, 0x07, 0xf0, 0x04, 0x80, 0x04, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    
            builder.AppendUserDefinedCharacter(0, 0x20, font);
            builder.AppendUserDefinedDbcsCharacter(0, 0x8140, dbcsFont);
        }
        else
        {
            builder.AppendUserDefinedDbcsCharacter(0, 0x8140, null);
        }
    
        byte[] textPattern = {0x5b, 0x20, 0x20, 0x53, 0x74, 0x61, 0x72, 0x20, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x6e, 0x69, 0x63, 0x73, 0x20, 0x20, 0x5d, 0x5b, 0x81, 0x40, 0x81, 0x40, 0x83, 0x58, 0x83, 0x5e, 0x81, 0x5b, 0x90, 0xb8, 0x96, 0xa7, 0x81, 0x40, 0x81, 0x40, 0x5d };
    
        builder.Append(textPattern);
    
        return builder.PassThroughCommands;
    }
    

    DisplayFunction.csを参照ください。

4.3.23. AppendUserDefinedDbcsCharacter

ユーザー定義文字(DBCS)登録コマンドを生成し、コマンドバッファに追加します。

  • 宣言

    void AppendUserDefinedDbcsCharacter(int index, int code, byte[] font);
    
  • 引数

    名称

    説明

    index

    フォント番号
    00h ≦ index ≦ 0Fh

    int

    code

    ユーザー定義文字の文字コード
    20h ≦ code ≦ 7Fh
    AppendCodePage メソッドで Japanese を指定した場合、以下の範囲も使用可能です。
    80 00h ≦ code ≦ FF FFh

    int

    font

    32byteのフォントデータ
    ユーザー定義文字のフォントデータのフォーマットを参照してください。
    null を指定すると、指定したフォント番号のユーザー定義文字を解除します。

    byte[]

  • 戻り値

なし

  • ユーザー定義文字のフォントデータのフォーマット

    ../_images/display_user_defined_dbcs_data.png
  • 実装例

    public static byte[] CreateUserDefinedCharacter(bool set)
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendHomePosition();
    
        builder.AppendInternational(DisplayInternationalType.USA);
        builder.AppendCodePage(DisplayCodePageType.Japanese);
    
        if (set)
        {
            byte[] font = { 0x00, 0x00, 0x32, 0x00, 0x49, 0x00, 0x49, 0x7f, 0x26, 0x48, 0x00, 0x48, 0x00, 0x30, 0x00, 0x00 };
            byte[] dbcsFont = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x20, 0x04, 0x90, 0x04, 0x90, 0x02, 0x60, 0x00, 0x00, 0x07, 0xf0, 0x04, 0x80, 0x04, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    
            builder.AppendUserDefinedCharacter(0, 0x20, font);
            builder.AppendUserDefinedDbcsCharacter(0, 0x8140, dbcsFont);
        }
        else
        {
            builder.AppendUserDefinedDbcsCharacter(0, 0x8140, null);
        }
    
        byte[] textPattern = {0x5b, 0x20, 0x20, 0x53, 0x74, 0x61, 0x72, 0x20, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x6e, 0x69, 0x63, 0x73, 0x20, 0x20, 0x5d, 0x5b, 0x81, 0x40, 0x81, 0x40, 0x83, 0x58, 0x83, 0x5e, 0x81, 0x5b, 0x90, 0xb8, 0x96, 0xa7, 0x81, 0x40, 0x81, 0x40, 0x5d };
    
        builder.Append(textPattern);
    
        return builder.PassThroughCommands;
    }
    

    DisplayFunction.csを参照ください。