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

InputManCellセルの基本クラスを表します。このクラスは抽象 (Visual BasicではMustInherit)クラスなので、インスタンス化できません。
構文
Public MustInherit Class InputManCellBase 
   Inherits GrapeCity.Win.MultiRow.Cell
public abstract class InputManCellBase : GrapeCity.Win.MultiRow.Cell 
使用例
以下は InputManCell を利用する場合にパフォーマンスを改善するためのサンプルコードです。このサンプルコードは、Text のみを利用して下記以外に描画の設定を行わない場合に効果のある方法です。
using System;
using System.Windows.Forms;
using System.Drawing;

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

        public MyDateCellDemo()
        {
            this.Text = "MyDateCell Demo";
            this.Size = new Size(990, 650);

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

            this.Load += new EventHandler(Form1_Load);

            this.StartPosition = FormStartPosition.CenterScreen;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            MyDateCell myTextBoxCell1 = new MyDateCell();
            myTextBoxCell1.Size = new Size(110, 21);
            myTextBoxCell1.Style.Format = "yyyy/MM/dd hh:mm:ss";
            myTextBoxCell1.Value = new DateTime(2009, 7, 10, 10, 20, 5);
            MyDateCell myTextBoxCell2 = new MyDateCell();
            myTextBoxCell2.Size = new Size(110, 21);
            myTextBoxCell2.Style.Format = "yyyy/MM/dd hh:mm:ss";
            myTextBoxCell2.Value = new DateTime(2006, 8, 11, 11, 30, 6);
            MyDateCell myTextBoxCell3 = new MyDateCell();
            myTextBoxCell3.Size = new Size(110, 21);
            myTextBoxCell3.Style.Format = "yyyy/MM/dd hh:mm:ss";
            myTextBoxCell3.Value = new DateTime(2007, 9, 12, 12, 40, 7);
            MyDateCell myTextBoxCell4 = new MyDateCell();
            myTextBoxCell4.Size = new Size(110, 21);
            myTextBoxCell4.Style.Format = "yyyy/MM/dd hh:mm:ss";
            myTextBoxCell4.Value = new DateTime(2008, 10, 13, 13, 50, 8);

            myTextBoxCell1.Style.FormatProvider = System.Globalization.CultureInfo.InvariantCulture;
            Template template1 = Template.CreateGridTemplate(new Cell[] { 
                myTextBoxCell1, myTextBoxCell1.Clone() as Cell, myTextBoxCell1.Clone() as Cell, myTextBoxCell1.Clone() as Cell, myTextBoxCell1.Clone() as Cell, myTextBoxCell1.Clone() as Cell, myTextBoxCell1.Clone() as Cell, myTextBoxCell1.Clone() as Cell, myTextBoxCell1.Clone() as Cell,
            myTextBoxCell2, myTextBoxCell2.Clone() as Cell, myTextBoxCell2.Clone() as Cell, myTextBoxCell2.Clone() as Cell, myTextBoxCell2.Clone() as Cell, myTextBoxCell2.Clone() as Cell, myTextBoxCell2.Clone() as Cell, myTextBoxCell2.Clone() as Cell, myTextBoxCell2.Clone() as Cell,
            myTextBoxCell3, myTextBoxCell3.Clone() as Cell, myTextBoxCell3.Clone() as Cell, myTextBoxCell3.Clone() as Cell, myTextBoxCell3.Clone() as Cell, myTextBoxCell3.Clone() as Cell, myTextBoxCell3.Clone() as Cell, myTextBoxCell3.Clone() as Cell, myTextBoxCell3.Clone() as Cell,
            myTextBoxCell4, myTextBoxCell4.Clone() as Cell, myTextBoxCell4.Clone() as Cell, myTextBoxCell4.Clone() as Cell, myTextBoxCell4.Clone() as Cell, myTextBoxCell4.Clone() as Cell, myTextBoxCell4.Clone() as Cell, myTextBoxCell4.Clone() as Cell, myTextBoxCell4.Clone() as Cell}, 990,
                AutoGenerateGridTemplateStyles.ColumnHeader | AutoGenerateGridTemplateStyles.RowHeaderAutoNumber);

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

        [STAThreadAttribute()]
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.Run(new MyDateCellDemo());
        }
    }

    class MyDateCell : Cell
    {
        public override Type EditType
        {
            get
            {
                return typeof(GcDateTimeEditingControl);
            }
        }

        public override Type FormattedValueType
        {
            get
            {
                return typeof(string);
            }
        }

        protected override void InitializeEditingControl(int rowIndex, object formattedValue, CellStyle style)
        {
            base.InitializeEditingControl(rowIndex, formattedValue, style);
            GcDateTimeEditingControl gcDateTime = this.GcMultiRow.EditingControl as GcDateTimeEditingControl;
            if (formattedValue != null)
            {
                gcDateTime.FormattedValue = DateTime.Parse(formattedValue.ToString());
            }
            //You can initialize GcDateTimeEditingControl's any properties at here.
            gcDateTime.DropDownCalendar.SelectionStyle = new GrapeCity.Win.Editors.SubStyle(Color.GreenYellow, Color.Black);
            gcDateTime.DropDownCalendar.FlatStyle = FlatStyle.Flat;
            gcDateTime.DropDownCalendar.HeaderStyle = new GrapeCity.Win.Editors.Style(Color.AliceBlue, Color.Black);
        }
    }
}
Imports System
Imports System.Windows.Forms
Imports System.Drawing

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

        Public Sub New()
            Me.Text = "MyDateCell Demo"
            Me.Size = New Size(990, 650)

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

            Me.StartPosition = FormStartPosition.CenterScreen
        End Sub

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
            Dim myTextBoxCell1 As New MyDateCell()
            myTextBoxCell1.Size = New Size(110, 21)
            myTextBoxCell1.Style.Format = "yyyy/MM/dd hh:mm:ss"
            myTextBoxCell1.Value = New DateTime(2009, 7, 10, 10, 20, 5)
            Dim myTextBoxCell2 As New MyDateCell()
            myTextBoxCell2.Size = New Size(110, 21)
            myTextBoxCell2.Style.Format = "yyyy/MM/dd hh:mm:ss"
            myTextBoxCell2.Value = New DateTime(2006, 8, 11, 11, 30, 6)
            Dim myTextBoxCell3 As New MyDateCell()
            myTextBoxCell3.Size = New Size(110, 21)
            myTextBoxCell3.Style.Format = "yyyy/MM/dd hh:mm:ss"
            myTextBoxCell3.Value = New DateTime(2007, 9, 12, 12, 40, 7)
            Dim myTextBoxCell4 As New MyDateCell()
            myTextBoxCell4.Size = New Size(110, 21)
            myTextBoxCell4.Style.Format = "yyyy/MM/dd hh:mm:ss"
            myTextBoxCell4.Value = New DateTime(2008, 10, 13, 13, 50, 8)

            myTextBoxCell1.Style.FormatProvider = System.Globalization.CultureInfo.InvariantCulture
            Dim template1 As Template = Template.CreateGridTemplate(New Cell() {myTextBoxCell1, TryCast(myTextBoxCell1.Clone(), Cell), TryCast(myTextBoxCell1.Clone(), Cell), TryCast(myTextBoxCell1.Clone(), Cell), TryCast(myTextBoxCell1.Clone(), Cell), TryCast(myTextBoxCell1.Clone(), Cell), _
             TryCast(myTextBoxCell1.Clone(), Cell), TryCast(myTextBoxCell1.Clone(), Cell), TryCast(myTextBoxCell1.Clone(), Cell), myTextBoxCell2, TryCast(myTextBoxCell2.Clone(), Cell), TryCast(myTextBoxCell2.Clone(), Cell), _
             TryCast(myTextBoxCell2.Clone(), Cell), TryCast(myTextBoxCell2.Clone(), Cell), TryCast(myTextBoxCell2.Clone(), Cell), TryCast(myTextBoxCell2.Clone(), Cell), TryCast(myTextBoxCell2.Clone(), Cell), TryCast(myTextBoxCell2.Clone(), Cell), _
             myTextBoxCell3, TryCast(myTextBoxCell3.Clone(), Cell), TryCast(myTextBoxCell3.Clone(), Cell), TryCast(myTextBoxCell3.Clone(), Cell), TryCast(myTextBoxCell3.Clone(), Cell), TryCast(myTextBoxCell3.Clone(), Cell), _
             TryCast(myTextBoxCell3.Clone(), Cell), TryCast(myTextBoxCell3.Clone(), Cell), TryCast(myTextBoxCell3.Clone(), Cell), myTextBoxCell4, TryCast(myTextBoxCell4.Clone(), Cell), TryCast(myTextBoxCell4.Clone(), Cell), _
             TryCast(myTextBoxCell4.Clone(), Cell), TryCast(myTextBoxCell4.Clone(), Cell), TryCast(myTextBoxCell4.Clone(), Cell), TryCast(myTextBoxCell4.Clone(), Cell), TryCast(myTextBoxCell4.Clone(), Cell), TryCast(myTextBoxCell4.Clone(), Cell)}, 990, AutoGenerateGridTemplateStyles.ColumnHeader Or AutoGenerateGridTemplateStyles.RowHeaderAutoNumber)

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

        <STAThreadAttribute()> _
        Public Shared Sub Main()
            Application.EnableVisualStyles()
            Application.Run(New MyDateCellDemo())
        End Sub
    End Class

    Class MyDateCell
        Inherits Cell
        Public Overloads Overrides ReadOnly Property EditType() As Type
            Get
                Return GetType(GcDateTimeEditingControl)
            End Get
        End Property

        Public Overloads Overrides ReadOnly Property FormattedValueType() As Type
            Get
                Return GetType(String)
            End Get
        End Property

        Protected Overloads Overrides Sub InitializeEditingControl(ByVal rowIndex As Integer, ByVal formattedValue As Object, ByVal style As CellStyle)
            MyBase.InitializeEditingControl(rowIndex, formattedValue, style)
            Dim gcDateTime As GcDateTimeEditingControl = TryCast(Me.GcMultiRow.EditingControl, GcDateTimeEditingControl)
            If formattedValue <> Nothing Then
                gcDateTime.FormattedValue = DateTime.Parse(formattedValue.ToString())
            End If
            'You can initialize GcDateTimeEditingControl's any properties at here.
            gcDateTime.DropDownCalendar.SelectionStyle = New Global.GrapeCity.Win.Editors.SubStyle(Color.GreenYellow, Color.Black)
            gcDateTime.DropDownCalendar.FlatStyle = FlatStyle.Flat
            gcDateTime.DropDownCalendar.HeaderStyle = New Global.GrapeCity.Win.Editors.Style(Color.AliceBlue, Color.Black)
        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.GcCharMaskCell
               GrapeCity.Win.MultiRow.InputMan.GcComboBoxCell
               GrapeCity.Win.MultiRow.InputMan.GcTextBoxCell

参照

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

 

 


© 2008-2015 GrapeCity inc. All rights reserved.