PowerTools MultiRow for Windows Forms 8.0J
GcMaskCell クラス
メンバ  使用例 

GcMaskCellを表します。
構文
Public Class GcMaskCell 
   Inherits FieldsEditorCell
public class GcMaskCell : FieldsEditorCell 
使用例
次のサンプルコードは、GcMaskCell の使用例です。
using System;
using System.Windows.Forms;
using System.Drawing;

namespace GrapeCity.Win.MultiRow.InputMan.SampleCode
{
    class GcMaskCellDemo : Form
    {
        private GcMultiRow gcMultiRow1 = new GcMultiRow();
        private Label label = new Label();

        public GcMaskCellDemo()
        {
            this.Text = "GcMaskCell Demo";
            this.Size = new Size(350, 300);

            // Add MultiRow to form
            this.gcMultiRow1.Dock = DockStyle.Fill;
            this.Controls.Add(this.gcMultiRow1);

            this.label.Dock = DockStyle.Bottom;
            this.label.Height = 50;
            this.label.BackColor = SystemColors.Info;
            this.label.Text = "You can only input the post code to these GcMaskCell, and hit the F6 to clear the value.";
            this.Controls.Add(label);

            this.Load += new EventHandler(Form1_Load);

            this.StartPosition = FormStartPosition.CenterScreen;
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            GcMaskCell gcMaskCell1 = new GcMaskCell();
            SetGcMaskCellFields(gcMaskCell1);

            gcMaskCell1.ShortcutKeys.Add(Keys.F6, "ShortcutClear");
            Template template1 = Template.CreateGridTemplate(new Cell[] { gcMaskCell1, gcMaskCell1.Clone() as Cell }, 200,
                AutoGenerateGridTemplateStyles.ColumnHeader | AutoGenerateGridTemplateStyles.RowHeaderAutoNumber);

            gcMultiRow1.Template = template1;
            gcMultiRow1.RowCount = 3;
        }

        private void SetGcMaskCellFields(GcMaskCell gcMaskCell1)
        {
            gcMaskCell1.Fields.Clear();

            MaskPatternField maskPatternField1 = new MaskPatternField();
            MaskLiteralField maskLiteralField1 = new MaskLiteralField();
            MaskPatternField maskPatternField2 = new MaskPatternField();

            maskPatternField1.MaxLength = 3;
            maskPatternField1.MinLength = 3;
            maskPatternField1.Pattern = "\\D";
            maskLiteralField1.Text = "-";
            maskPatternField2.MaxLength = 4;
            maskPatternField2.MinLength = 4;
            maskPatternField2.Pattern = "\\D";

            gcMaskCell1.Fields.AddRange(new MaskField[] { maskPatternField1, maskLiteralField1, maskPatternField2 });
        }

        [STAThreadAttribute()]
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.Run(new GcMaskCellDemo());
        }
    }
}
Imports System
Imports System.Windows.Forms
Imports System.Drawing

Namespace GrapeCity.Win.MultiRow.InputMan.SampleCode
    Class GcMaskCellDemo
        Inherits Form
        Private gcMultiRow1 As New GcMultiRow()
        Private label As New Label()

        Public Sub New()
            Me.Text = "GcMaskCell Demo"
            Me.Size = New Size(350, 300)

            ' Add MultiRow to form
            Me.gcMultiRow1.Dock = DockStyle.Fill
            Me.Controls.Add(Me.gcMultiRow1)

            Me.label.Dock = DockStyle.Bottom
            Me.label.Height = 50
            Me.label.BackColor = SystemColors.Info
            Me.label.Text = "You can only input the post code to these GcMaskCell, and hit the F6 to clear the value."
            Me.Controls.Add(label)

            Me.StartPosition = FormStartPosition.CenterScreen
        End Sub
        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
            Dim gcMaskCell1 As New GcMaskCell()
            SetGcMaskCellFields(gcMaskCell1)

            gcMaskCell1.ShortcutKeys.Add(Keys.F6, "ShortcutClear")
            Dim template1 As Template = Template.CreateGridTemplate(New Cell() {gcMaskCell1, TryCast(gcMaskCell1.Clone(), Cell)}, 200, AutoGenerateGridTemplateStyles.ColumnHeader Or AutoGenerateGridTemplateStyles.RowHeaderAutoNumber)

            gcMultiRow1.Template = template1
            gcMultiRow1.RowCount = 3
        End Sub

        Private Sub SetGcMaskCellFields(ByVal gcMaskCell1 As GcMaskCell)
            gcMaskCell1.Fields.Clear()

            Dim maskPatternField1 As New MaskPatternField()
            Dim maskLiteralField1 As New MaskLiteralField()
            Dim maskPatternField2 As New MaskPatternField()

            maskPatternField1.MaxLength = 3
            maskPatternField1.MinLength = 3
            maskPatternField1.Pattern = "\D"
            maskLiteralField1.Text = "-"
            maskPatternField2.MaxLength = 4
            maskPatternField2.MinLength = 4
            maskPatternField2.Pattern = "\D"

            gcMaskCell1.Fields.AddRange(New MaskField() {maskPatternField1, maskLiteralField1, maskPatternField2})
        End Sub

        <STAThreadAttribute()> _
        Public Shared Sub Main()
            Application.EnableVisualStyles()
            Application.Run(New GcMaskCellDemo())
        End Sub
    End Class
End Namespace
継承階層

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         GrapeCity.Win.MultiRow.Cell
            GrapeCity.Win.MultiRow.InputMan.InputManCellBase
               GrapeCity.Win.MultiRow.InputMan.FieldsEditorCell
                  GrapeCity.Win.MultiRow.InputMan.GcMaskCell
                     GrapeCity.Win.MultiRow.InputMan.GcAddressBoxCell
                     GrapeCity.Win.MultiRow.InputMan.GcPostalCell

参照

GcMaskCell メンバ
GrapeCity.Win.MultiRow.InputMan 名前空間

 

 


© 2008-2015 GrapeCity inc. All rights reserved.