PowerTools InputMan for Windows Forms 8.0J
CharBoxSpacing プロパティ
使用例 

マス目間の距離を取得または設定します。
構文
Public Property CharBoxSpacing As Integer
public int CharBoxSpacing {get; set;}

プロパティ値

距離をピクセル単位で指定するInt32値。 既定値は-1です。
解説
CharBoxSpacing プロパティは、隣接する2つのキャラクターボックスの間隔を決定します。
使用例
マス目を設定した GcCharMask コントロールを作成するコード例を次に示します。この例では他に CharBoxes と CharBoxSpacing プロパティを使用しています。
//  Please use the following namespace
//  using System.Windows.Forms;
//  using GrapeCity.Win.Editors;

public void SetCharBoxSettings()
{
    // Create an instance of a GcMask control.
    GcCharMask gcCharMask1 = new GcCharMask();
    // Clear the default CharBoxes.
    gcCharMask1.CharBoxes.Clear();

    // Defines some CharBoxBorders.
    CharBoxBorder charBoxBorder1 = new CharBoxBorder();
    CharBoxBorder charBoxBorder2 = new CharBoxBorder();
    CharBoxBorder charBoxBorder3 = new CharBoxBorder();
    CharBoxBorder charBoxBorder4 = new CharBoxBorder();
    CharBoxBorder charBoxBorder5 = new CharBoxBorder();
    CharBoxBorder charBoxBorder6 = new CharBoxBorder();
    CharBoxBorder charBoxBorder7 = new CharBoxBorder();
    CharBoxBorder charBoxBorder8 = new CharBoxBorder();
    CharBoxBorder charBoxBorder9 = new CharBoxBorder();

    charBoxBorder2.Bottom = new Line(LineStyle.Dashed, System.Drawing.Color.Black);
    charBoxBorder2.Left = new Line(LineStyle.Single, System.Drawing.Color.Black);
    charBoxBorder2.Right = new Line(LineStyle.Single, System.Drawing.Color.Black);
    charBoxBorder2.Top = new Line(LineStyle.Single, System.Drawing.Color.Black);
    charBoxBorder3.Bottom = new Line(LineStyle.Dashed, System.Drawing.Color.Black);
    charBoxBorder3.Left = new Line(LineStyle.Single, System.Drawing.Color.Black);
    charBoxBorder3.Right = new Line(LineStyle.Single, System.Drawing.Color.Black);
    charBoxBorder3.Top = new Line(LineStyle.Single, System.Drawing.Color.Black);
    charBoxBorder4.Bottom = new Line(LineStyle.Dashed, System.Drawing.Color.Black);
    charBoxBorder4.Left = new Line(LineStyle.Single, System.Drawing.Color.Black);
    charBoxBorder4.Right = new Line(LineStyle.Single, System.Drawing.Color.Black);
    charBoxBorder4.Top = new Line(LineStyle.Single, System.Drawing.Color.Black);
    charBoxBorder5.Bottom = new Line(LineStyle.None, System.Drawing.Color.Empty);
    charBoxBorder5.Left = new Line(LineStyle.None, System.Drawing.Color.Empty);
    charBoxBorder5.Right = new Line(LineStyle.None, System.Drawing.Color.Empty);
    charBoxBorder5.Top = new Line(LineStyle.None, System.Drawing.Color.Empty);
    charBoxBorder6.Bottom = new Line(LineStyle.Dashed, System.Drawing.Color.Black);
    charBoxBorder6.Left = new Line(LineStyle.Single, System.Drawing.Color.Black);
    charBoxBorder6.Right = new Line(LineStyle.Single, System.Drawing.Color.Black);
    charBoxBorder6.Top = new Line(LineStyle.Single, System.Drawing.Color.Black);
    charBoxBorder7.Bottom = new Line(LineStyle.Dashed, System.Drawing.Color.Black);
    charBoxBorder7.Left = new Line(LineStyle.Single, System.Drawing.Color.Black);
    charBoxBorder7.Right = new Line(LineStyle.Single, System.Drawing.Color.Black);
    charBoxBorder7.Top = new Line(LineStyle.Single, System.Drawing.Color.Black);
    charBoxBorder8.Bottom = new Line(LineStyle.Dashed, System.Drawing.Color.Black);
    charBoxBorder8.Left = new Line(LineStyle.Single, System.Drawing.Color.Black);
    charBoxBorder8.Right = new Line(LineStyle.Single, System.Drawing.Color.Black);
    charBoxBorder8.Top = new Line(LineStyle.Single, System.Drawing.Color.Black);
    charBoxBorder9.Bottom = new Line(LineStyle.Dashed, System.Drawing.Color.Black);
    charBoxBorder9.Left = new Line(LineStyle.Single, System.Drawing.Color.Black);
    charBoxBorder9.Right = new Line(LineStyle.Single, System.Drawing.Color.Black);
    charBoxBorder9.Top = new Line(LineStyle.Single, System.Drawing.Color.Black);

    // Adds some CharBoxes.
    gcCharMask1.CharBoxes.AddRange(new CharBox[] {
    new LiteralBox(true, new System.Drawing.Size(16, 17), System.Drawing.Color.Transparent, System.Drawing.Color.Empty, CharBoxStyle.Normal, new System.Windows.Forms.Padding(0), new System.Windows.Forms.Padding(1), charBoxBorder1, null, System.Drawing.ContentAlignment.MiddleCenter, "〒"),
    new InputBox(false, new System.Drawing.Size(17, 20), System.Drawing.Color.Transparent, System.Drawing.Color.Empty, CharBoxStyle.BottomQuarter, new System.Windows.Forms.Padding(2), new System.Windows.Forms.Padding(1), charBoxBorder2, null, System.Drawing.ContentAlignment.MiddleCenter),
    new InputBox(false, new System.Drawing.Size(17, 20), System.Drawing.Color.Transparent, System.Drawing.Color.Empty, CharBoxStyle.BottomQuarter, new System.Windows.Forms.Padding(2), new System.Windows.Forms.Padding(1), charBoxBorder3, null, System.Drawing.ContentAlignment.MiddleCenter),
    new InputBox(false, new System.Drawing.Size(17, 20), System.Drawing.Color.Transparent, System.Drawing.Color.Empty, CharBoxStyle.BottomQuarter, new System.Windows.Forms.Padding(2), new System.Windows.Forms.Padding(1), charBoxBorder4, null, System.Drawing.ContentAlignment.MiddleCenter),
    new LiteralBox(false, new System.Drawing.Size(8, 20), System.Drawing.Color.Transparent, System.Drawing.Color.Empty, CharBoxStyle.Normal, new System.Windows.Forms.Padding(0, 2, 0, 2), new System.Windows.Forms.Padding(1), charBoxBorder5, null, System.Drawing.ContentAlignment.MiddleCenter, "-"),
    new InputBox(false, new System.Drawing.Size(15, 17), System.Drawing.Color.Transparent, System.Drawing.Color.Empty, CharBoxStyle.BottomQuarter, new System.Windows.Forms.Padding(2), new System.Windows.Forms.Padding(1), charBoxBorder6, null, System.Drawing.ContentAlignment.MiddleCenter),
    new InputBox(false, new System.Drawing.Size(15, 17), System.Drawing.Color.Transparent, System.Drawing.Color.Empty, CharBoxStyle.BottomQuarter, new System.Windows.Forms.Padding(2), new System.Windows.Forms.Padding(1), charBoxBorder7, null, System.Drawing.ContentAlignment.MiddleCenter),
    new InputBox(false, new System.Drawing.Size(15, 17), System.Drawing.Color.Transparent, System.Drawing.Color.Empty, CharBoxStyle.BottomQuarter, new System.Windows.Forms.Padding(2), new System.Windows.Forms.Padding(1), charBoxBorder8, null, System.Drawing.ContentAlignment.MiddleCenter),
    new InputBox(false, new System.Drawing.Size(15, 17), System.Drawing.Color.Transparent, System.Drawing.Color.Empty, CharBoxStyle.BottomQuarter, new System.Windows.Forms.Padding(2), new System.Windows.Forms.Padding(1), charBoxBorder9, null, System.Drawing.ContentAlignment.MiddleCenter)});

    // Sets the AutoSize to fix the size.
    gcCharMask1.AutoSize = true;

    // Sets the CharBoxSpacing to defines the distance of every charbox.
    gcCharMask1.CharBoxSpacing = 2;
}
'  Please use the following namespace
'  Imports System.Windows.Forms;
'  Imports GrapeCity.Win.Editors;

Public Sub SetCharBoxSettings()
    ' Create an instance of a GcMask control.
    Dim gcCharMask1 As New GcCharMask()
    ' Clear the default CharBoxes.
    gcCharMask1.CharBoxes.Clear()

    ' Defines some CharBoxBorders.
    Dim charBoxBorder1 As New CharBoxBorder()
    Dim charBoxBorder2 As New CharBoxBorder()
    Dim charBoxBorder3 As New CharBoxBorder()
    Dim charBoxBorder4 As New CharBoxBorder()
    Dim charBoxBorder5 As New CharBoxBorder()
    Dim charBoxBorder6 As New CharBoxBorder()
    Dim charBoxBorder7 As New CharBoxBorder()
    Dim charBoxBorder8 As New CharBoxBorder()
    Dim charBoxBorder9 As New CharBoxBorder()

    charBoxBorder2.Bottom = New Line(LineStyle.Dashed, System.Drawing.Color.Black)
    charBoxBorder2.Left = New Line(LineStyle.[Single], System.Drawing.Color.Black)
    charBoxBorder2.Right = New Line(LineStyle.[Single], System.Drawing.Color.Black)
    charBoxBorder2.Top = New Line(LineStyle.[Single], System.Drawing.Color.Black)
    charBoxBorder3.Bottom = New Line(LineStyle.Dashed, System.Drawing.Color.Black)
    charBoxBorder3.Left = New Line(LineStyle.[Single], System.Drawing.Color.Black)
    charBoxBorder3.Right = New Line(LineStyle.[Single], System.Drawing.Color.Black)
    charBoxBorder3.Top = New Line(LineStyle.[Single], System.Drawing.Color.Black)
    charBoxBorder4.Bottom = New Line(LineStyle.Dashed, System.Drawing.Color.Black)
    charBoxBorder4.Left = New Line(LineStyle.[Single], System.Drawing.Color.Black)
    charBoxBorder4.Right = New Line(LineStyle.[Single], System.Drawing.Color.Black)
    charBoxBorder4.Top = New Line(LineStyle.[Single], System.Drawing.Color.Black)
    charBoxBorder5.Bottom = New Line(LineStyle.None, System.Drawing.Color.Empty)
    charBoxBorder5.Left = New Line(LineStyle.None, System.Drawing.Color.Empty)
    charBoxBorder5.Right = New Line(LineStyle.None, System.Drawing.Color.Empty)
    charBoxBorder5.Top = New Line(LineStyle.None, System.Drawing.Color.Empty)
    charBoxBorder6.Bottom = New Line(LineStyle.Dashed, System.Drawing.Color.Black)
    charBoxBorder6.Left = New Line(LineStyle.[Single], System.Drawing.Color.Black)
    charBoxBorder6.Right = New Line(LineStyle.[Single], System.Drawing.Color.Black)
    charBoxBorder6.Top = New Line(LineStyle.[Single], System.Drawing.Color.Black)
    charBoxBorder7.Bottom = New Line(LineStyle.Dashed, System.Drawing.Color.Black)
    charBoxBorder7.Left = New Line(LineStyle.[Single], System.Drawing.Color.Black)
    charBoxBorder7.Right = New Line(LineStyle.[Single], System.Drawing.Color.Black)
    charBoxBorder7.Top = New Line(LineStyle.[Single], System.Drawing.Color.Black)
    charBoxBorder8.Bottom = New Line(LineStyle.Dashed, System.Drawing.Color.Black)
    charBoxBorder8.Left = New Line(LineStyle.[Single], System.Drawing.Color.Black)
    charBoxBorder8.Right = New Line(LineStyle.[Single], System.Drawing.Color.Black)
    charBoxBorder8.Top = New Line(LineStyle.[Single], System.Drawing.Color.Black)
    charBoxBorder9.Bottom = New Line(LineStyle.Dashed, System.Drawing.Color.Black)
    charBoxBorder9.Left = New Line(LineStyle.[Single], System.Drawing.Color.Black)
    charBoxBorder9.Right = New Line(LineStyle.[Single], System.Drawing.Color.Black)
    charBoxBorder9.Top = New Line(LineStyle.[Single], System.Drawing.Color.Black)

    ' Adds some CharBoxes.
    gcCharMask1.CharBoxes.AddRange(New CharBox() {New LiteralBox(True, New System.Drawing.Size(16, 17), System.Drawing.Color.Transparent, System.Drawing.Color.Empty, CharBoxStyle.Normal, New System.Windows.Forms.Padding(0), _
     New System.Windows.Forms.Padding(1), charBoxBorder1, Nothing, System.Drawing.ContentAlignment.MiddleCenter, "〒"), New InputBox(False, New System.Drawing.Size(17, 20), System.Drawing.Color.Transparent, System.Drawing.Color.Empty, CharBoxStyle.BottomQuarter, New System.Windows.Forms.Padding(2), _
     New System.Windows.Forms.Padding(1), charBoxBorder2, Nothing, System.Drawing.ContentAlignment.MiddleCenter), New InputBox(False, New System.Drawing.Size(17, 20), System.Drawing.Color.Transparent, System.Drawing.Color.Empty, CharBoxStyle.BottomQuarter, New System.Windows.Forms.Padding(2), _
     New System.Windows.Forms.Padding(1), charBoxBorder3, Nothing, System.Drawing.ContentAlignment.MiddleCenter), New InputBox(False, New System.Drawing.Size(17, 20), System.Drawing.Color.Transparent, System.Drawing.Color.Empty, CharBoxStyle.BottomQuarter, New System.Windows.Forms.Padding(2), _
     New System.Windows.Forms.Padding(1), charBoxBorder4, Nothing, System.Drawing.ContentAlignment.MiddleCenter), New LiteralBox(False, New System.Drawing.Size(8, 20), System.Drawing.Color.Transparent, System.Drawing.Color.Empty, CharBoxStyle.Normal, New System.Windows.Forms.Padding(0, 2, 0, 2), _
     New System.Windows.Forms.Padding(1), charBoxBorder5, Nothing, System.Drawing.ContentAlignment.MiddleCenter, "-"), New InputBox(False, New System.Drawing.Size(15, 17), System.Drawing.Color.Transparent, System.Drawing.Color.Empty, CharBoxStyle.BottomQuarter, New System.Windows.Forms.Padding(2), _
     New System.Windows.Forms.Padding(1), charBoxBorder6, Nothing, System.Drawing.ContentAlignment.MiddleCenter), _
     New InputBox(False, New System.Drawing.Size(15, 17), System.Drawing.Color.Transparent, System.Drawing.Color.Empty, CharBoxStyle.BottomQuarter, New System.Windows.Forms.Padding(2), _
     New System.Windows.Forms.Padding(1), charBoxBorder7, Nothing, System.Drawing.ContentAlignment.MiddleCenter), New InputBox(False, New System.Drawing.Size(15, 17), System.Drawing.Color.Transparent, System.Drawing.Color.Empty, CharBoxStyle.BottomQuarter, New System.Windows.Forms.Padding(2), _
     New System.Windows.Forms.Padding(1), charBoxBorder8, Nothing, System.Drawing.ContentAlignment.MiddleCenter), New InputBox(False, New System.Drawing.Size(15, 17), System.Drawing.Color.Transparent, System.Drawing.Color.Empty, CharBoxStyle.BottomQuarter, New System.Windows.Forms.Padding(2), _
     New System.Windows.Forms.Padding(1), charBoxBorder9, Nothing, System.Drawing.ContentAlignment.MiddleCenter)})

    ' Sets the AutoSize to fix the size.
    gcCharMask1.AutoSize = True

    ' Sets the CharBoxSpacing to defines the distance of every charbox.
    gcCharMask1.CharBoxSpacing = 2
End Sub
参照

GcCharMask クラス
GcCharMask メンバ
CharBoxes プロパティ

 

 


© 2004-2015 GrapeCity inc. All rights reserved.