GrapeCity CalendarGrid for Windows Forms 2.0J
CalendarGcNumberCellType クラス
メンバ  使用例 

CalendarGcNumberCellType を表します。
構文
Public Class CalendarGcNumberCellType 
   Inherits CalendarFieldsEditorCell
public class CalendarGcNumberCellType : CalendarFieldsEditorCell 
解説
GcNumberCell は、正および負の数値の入力を提供します。GcNumberCell を使用すると、機能的な数値入力インタフェースを迅速かつ効率的に設計できます。データの入力中、ユーザーはいつでも負の符号("-")を押して正の数値を負に切り替えることができます。また、正の符号("+")を押すと、負の数値が正に変わります。
使用例
次のサンプルコードは、CalendarGcNumberCellType の使用方法を示します。
using System;
using System.Windows.Forms;
using System.Drawing;
using GrapeCity.Win.CalendarGrid.InputMan;
using GrapeCity.Win.CalendarGrid;

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

        public GcNumberCellDemo()
        {
            this.Text = "GcNumberCell 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 = "Enter edit mode, click the SpinButton to modify the each field value; exit the edit mode, only the integral part will display.";
            this.Controls.Add(label);

            this.Load += Form1_Load;

            this.StartPosition = FormStartPosition.CenterScreen;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            CalendarGcNumberCellType gcNumberCell1 = new CalendarGcNumberCellType();
            SetGcNumberCellDisplayFields(gcNumberCell1);
            SetShortcutsAndSideButtons(gcNumberCell1);

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

            gcCalendarGrid1.Template = template1;
        }

        private void SetGcNumberCellDisplayFields(CalendarGcNumberCellType gcNumberCell1)
        {
            gcNumberCell1.DisplayFields.Clear();

            NumberSignDisplayField numberSignDisplayField1 = new NumberSignDisplayField();
            NumberIntegerPartDisplayField numberIntegerPartDisplayField1 = new NumberIntegerPartDisplayField();

            numberIntegerPartDisplayField1.GroupSizes = new int[] { 0 };
            numberIntegerPartDisplayField1.MinDigits = 0;

            gcNumberCell1.DisplayFields.AddRange(new NumberDisplayField[] { numberSignDisplayField1, numberIntegerPartDisplayField1 });
        }

        private void SetShortcutsAndSideButtons(CalendarGcNumberCellType gcNumberCell1)
        {
            gcNumberCell1.SideButtons.Clear();
            gcNumberCell1.SideButtons.Add(new SpinButton());
        }

        [STAThreadAttribute()]
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.Run(new GcNumberCellDemo());
        }
    }
}
Imports System.Windows.Forms
Imports System.Drawing
Imports GrapeCity.Win.CalendarGrid.InputMan
Imports GrapeCity.Win.CalendarGrid

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

        Public Sub New()
            Me.Text = "GcNumberCell 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 = "Enter edit mode, click the SpinButton to modify the each field value; exit the edit mode, only the integral part will display."
            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 gcNumberCell1 As New CalendarGcNumberCellType()
            SetGcNumberCellDisplayFields(gcNumberCell1)
            SetShortcutsAndSideButtons(gcNumberCell1)

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

            gcCalendarGrid1.Template = template1
        End Sub

        Private Sub SetGcNumberCellDisplayFields(gcNumberCell1 As CalendarGcNumberCellType)
            gcNumberCell1.DisplayFields.Clear()

            Dim numberSignDisplayField1 As New NumberSignDisplayField()
            Dim numberIntegerPartDisplayField1 As New NumberIntegerPartDisplayField()

            numberIntegerPartDisplayField1.GroupSizes = New Integer() {0}
            numberIntegerPartDisplayField1.MinDigits = 0

            gcNumberCell1.DisplayFields.AddRange(New NumberDisplayField() {numberSignDisplayField1, numberIntegerPartDisplayField1})
        End Sub

        Private Sub SetShortcutsAndSideButtons(gcNumberCell1 As CalendarGcNumberCellType)
            gcNumberCell1.SideButtons.Clear()
            gcNumberCell1.SideButtons.Add(New SpinButton())
        End Sub

        <STAThreadAttribute> _
        Public Shared Sub Main()
            Application.EnableVisualStyles()
            Application.Run(New GcNumberCellDemo())
        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.CalendarGcNumberCellType

参照

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

 

 


c 2008 GrapeCity inc. All rights reserved.