PowerTools CalendarGrid for Windows Forms 1.0J
CalendarGcMaskCellType クラス
メンバ  使用例 

CalendarGcMaskCellType を表します。
構文
Public Class CalendarGcMaskCellType 
   Inherits CalendarFieldsEditorCell
public class CalendarGcMaskCellType : CalendarFieldsEditorCell 
使用例
次のサンプルコードは、CalendarGcMaskCellType の使用方法を示します。
using System;
using System.Windows.Forms;
using System.Drawing;
using GrapeCity.Win.CalendarGrid.InputMan;
using GrapeCity.Win.CalendarGrid;

namespace CalendarGridSampleCode
{
    class GcMaskCellDemo : Form
    {
        private GcCalendarGrid gcCalendarGrid1 = new GcCalendarGrid();
        private Label label = new Label();

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

            // Add GcCalendarGrid to form
            this.gcCalendarGrid1.Dock = DockStyle.Fill;
            this.Controls.Add(this.gcCalendarGrid1);

            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.";
            this.Controls.Add(label);

            this.Load += Form1_Load;

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

            CalendarTemplate template1 = CalendarTemplate.CreateDefaultTemplate();
            template1.Content[1, 0].CellType = gcMaskCell1;
            template1.Content[2, 0].CellType = gcMaskCell1.Clone();

            gcCalendarGrid1.Template = template1;
        }

        private void SetGcMaskCellFields(CalendarGcMaskCellType 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.Windows.Forms
Imports System.Drawing
Imports GrapeCity.Win.CalendarGrid.InputMan
Imports GrapeCity.Win.CalendarGrid

Namespace CalendarGridSampleCode
    Class GcMaskCellDemo
        Inherits Form
        Private gcCalendarGrid1 As New GcCalendarGrid()
        Private label As New Label()

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

            ' Add GcCalendarGrid to form
            Me.gcCalendarGrid1.Dock = DockStyle.Fill
            Me.Controls.Add(Me.gcCalendarGrid1)

            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."
            Me.Controls.Add(label)

            AddHandler Me.Load, AddressOf Form1_Load

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

            Dim template1 As CalendarTemplate = CalendarTemplate.CreateDefaultTemplate()
            template1.Content(1, 0).CellType = gcMaskCell1
            template1.Content(2, 0).CellType = gcMaskCell1.Clone()

            gcCalendarGrid1.Template = template1
        End Sub

        Private Sub SetGcMaskCellFields(gcMaskCell1 As CalendarGcMaskCellType)
            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
   GrapeCity.Win.CalendarGrid.CalendarCellType
      GrapeCity.Win.CalendarGrid.InputMan.CalendarInputManCellBaseType
         GrapeCity.Win.CalendarGrid.InputMan.CalendarFieldsEditorCell
            GrapeCity.Win.CalendarGrid.InputMan.CalendarGcMaskCellType

参照

CalendarGcMaskCellType メンバ
GrapeCity.Win.CalendarGrid.InputMan 名前空間

 

 


© 2014 GrapeCity inc. All rights reserved.