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

GcDateTimeCell内のGcDateTimeコントロールを表します。
構文
Public Class GcDateTimeEditingControl 
   Inherits GrapeCity.Win.Editors.GcDateTime
   Implements GrapeCity.Win.MultiRow.IEditingControl 
public class GcDateTimeEditingControl : GrapeCity.Win.Editors.GcDateTime, GrapeCity.Win.MultiRow.IEditingControl  
解説

GcDateTimeEditingControlクラスはGrapeCity.Win.MultiRow.IEditingControlインタフェースを実装する特殊化されたGcDateTime で、セルが編集モードのときにCell内でホストできます。GcDateTimeEditingControlは、Cellが編集モードのときに、GrapeCity.Win.MultiRow.GcMultiRowコントロールのGrapeCity.Win.MultiRow.GcMultiRow.EditingControlプロパティを通じて取得できます。

セルが編集モードに入るときに編集コントロールを独自に初期化する場合は、GrapeCity.Win.MultiRow.GcMultiRow.EditingControlShowingイベントを処理します。編集コントロールの表示特性をカスタマイズするには、GrapeCity.Win.MultiRow.EditingControlShowingEventArgs.Controlプロパティによって返されたコントロールのプロパティを設定するのではなく、GrapeCity.Win.MultiRow.EditingControlShowingEventArgs.CellStyleプロパティによって返されたオブジェクトのプロパティを設定します。

使用例
以下のサンプルコードは GcDateTimeEditingControl の使用例です。
using System;
using System.Windows.Forms;
using System.Drawing;
using GrapeCity.Win.Editors;

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

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

            // Add MultiRow to form
            this.gcMultiRow1.Dock = DockStyle.Fill;
            this.gcMultiRow1.EditMode = EditMode.EditOnEnter;
            this.gcMultiRow1.EditingControlShowing += new EventHandler<EditingControlShowingEventArgs>(gcMultiRow1_EditingControlShowing);
            this.Controls.Add(this.gcMultiRow1);

            this.label.Dock = DockStyle.Bottom;
            this.label.Height = 30;
            this.label.BackColor = SystemColors.Info;
            this.label.Text = "In edit mode, hit the CTR + Left/Right to move the active field, one animation effect will show.";
            this.Controls.Add(label);

            this.Load += new EventHandler(Form1_Load);

            this.StartPosition = FormStartPosition.CenterScreen;
        }

        private void gcMultiRow1_EditingControlShowing(object sender, EditingControlShowingEventArgs e)
        {
            GcDateTime gcDateTime1 = e.Control as GcDateTime;

            gcDateTime1.FieldEnter -= new EventHandler<FieldEventArgs>(gcDateTime1_FieldEnter);
            gcDateTime1.FieldEnter += new EventHandler<FieldEventArgs>(gcDateTime1_FieldEnter);

            gcDateTime1.FieldLeave -= new EventHandler<FieldEventArgs>(gcDateTime1_FieldLeave);
            gcDateTime1.FieldLeave += new EventHandler<FieldEventArgs>(gcDateTime1_FieldLeave);
        }

        void gcDateTime1_FieldEnter(object sender, FieldEventArgs e)
        {
            e.Field.Font = new Font(e.Field.Font.FontFamily, e.Field.Font.Size + 6);
            e.Field.ForeColor = Color.Red;
        }

        void gcDateTime1_FieldLeave(object sender, FieldEventArgs e)
        {
            e.Field.Font = new Font(e.Field.Font.FontFamily, e.Field.Font.Size - 6);
            e.Field.ForeColor = SystemColors.WindowText;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            GcDateTimeCell gcDateTimeCell1 = new GcDateTimeCell();
            gcDateTimeCell1.Value = DateTime.Now;
            gcDateTimeCell1.Size = new Size(150, 40);
            Template template1 = Template.CreateGridTemplate(new Cell[] { gcDateTimeCell1 }, 160,
                AutoGenerateGridTemplateStyles.ColumnHeader | AutoGenerateGridTemplateStyles.RowHeaderAutoNumber);

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

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

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

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

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

            Me.label.Dock = DockStyle.Bottom
            Me.label.Height = 30
            Me.label.BackColor = SystemColors.Info
            Me.label.Text = "In edit mode, hit the CTR + Left/Right to move the active field, one animation effect will show."
            Me.Controls.Add(label)

            Me.StartPosition = FormStartPosition.CenterScreen
        End Sub

        Private Sub gcMultiRow1_EditingControlShowing(ByVal sender As Object, ByVal e As EditingControlShowingEventArgs) Handles gcMultiRow1.EditingControlShowing
            Dim gcDateTime1 As GcDateTime = TryCast(e.Control, GcDateTime)

            RemoveHandler gcDateTime1.FieldEnter, AddressOf gcDateTime1_FieldEnter
            AddHandler gcDateTime1.FieldEnter, AddressOf gcDateTime1_FieldEnter

            RemoveHandler gcDateTime1.FieldLeave, AddressOf gcDateTime1_FieldLeave
            AddHandler gcDateTime1.FieldLeave, AddressOf gcDateTime1_FieldLeave
        End Sub

        Private Sub gcDateTime1_FieldEnter(ByVal sender As Object, ByVal e As FieldEventArgs)
            e.Field.Font = New Font(e.Field.Font.FontFamily, e.Field.Font.Size + 6)
            e.Field.ForeColor = Color.Red
        End Sub

        Private Sub gcDateTime1_FieldLeave(ByVal sender As Object, ByVal e As FieldEventArgs)
            e.Field.Font = New Font(e.Field.Font.FontFamily, e.Field.Font.Size - 6)
            e.Field.ForeColor = SystemColors.WindowText
        End Sub

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
            Dim gcDateTimeCell1 As New GcDateTimeCell()
            gcDateTimeCell1.Value = DateTime.Now
            gcDateTimeCell1.Size = New Size(150, 40)
            Dim template1 As Template = Template.CreateGridTemplate(New Cell() {gcDateTimeCell1}, 160, AutoGenerateGridTemplateStyles.ColumnHeader Or AutoGenerateGridTemplateStyles.RowHeaderAutoNumber)

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

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

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Windows.Forms.Control
            GrapeCity.Framework.Forms.FrameworkControl
               GrapeCity.Framework.Views.Windows.ElementContainerControl
                  GrapeCity.Framework.Forms.ControlBase
                              GrapeCity.Win.MultiRow.InputMan.GcDateTimeEditingControl

参照

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

 

 


© 2008-2015 GrapeCity inc. All rights reserved.