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

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

GcTimeSpanEditingControlクラスはGrapeCity.Win.MultiRow.IEditingControlインタフェースを実装する特殊化されたGcTimeSpanで、セルが編集モードのときにCell内でホストできます。GcTimeSpanEditingControlは、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プロパティによって返されたオブジェクトのプロパティを設定します。

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

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

        public GcTimeSpanCellEditingControlDemo()
        {
            this.Text = "GcTimeSpanCellEditingControl 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.AutoSize = false;
            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)
        {
            GcTimeSpan gcTimeSpan1 = e.Control as GcTimeSpan;

            gcTimeSpan1.FieldEnter -= new EventHandler<FieldEventArgs>(gcTimeSpan1_FieldEnter);
            gcTimeSpan1.FieldEnter += new EventHandler<FieldEventArgs>(gcTimeSpan1_FieldEnter);

            gcTimeSpan1.FieldLeave -= new EventHandler<FieldEventArgs>(gcTimeSpan1_FieldLeave);
            gcTimeSpan1.FieldLeave += new EventHandler<FieldEventArgs>(gcTimeSpan1_FieldLeave);
        }

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

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

        private void Form1_Load(object sender, EventArgs e)
        {
            GcTimeSpanCell gcTimeSpanCell1 = new GcTimeSpanCell();
            gcTimeSpanCell1.Value = new TimeSpan(5, 10, 10);
            gcTimeSpanCell1.Size = new Size(120, 40);
            Template template1 = Template.CreateGridTemplate(new Cell[] { gcTimeSpanCell1 }, 160,
                AutoGenerateGridTemplateStyles.ColumnHeader | AutoGenerateGridTemplateStyles.RowHeaderAutoNumber);

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

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

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

        Public Sub New()
            Me.Text = "GcTimeSpanCellEditingControl 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.AutoSize = False
            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 gcTimeSpan1 As GcTimeSpan = TryCast(e.Control, GcTimeSpan)

            RemoveHandler gcTimeSpan1.FieldEnter, AddressOf gcTimeSpan1_FieldEnter
            AddHandler gcTimeSpan1.FieldEnter, AddressOf gcTimeSpan1_FieldEnter

            RemoveHandler gcTimeSpan1.FieldLeave, AddressOf gcTimeSpan1_FieldLeave
            AddHandler gcTimeSpan1.FieldLeave, AddressOf gcTimeSpan1_FieldLeave
        End Sub

        Private Sub gcTimeSpan1_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 gcTimeSpan1_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 Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
            Dim gcTimeSpanCell1 As New GcTimeSpanCell()
            gcTimeSpanCell1.Value = New TimeSpan(5, 10, 10)
            gcTimeSpanCell1.Size = New Size(120, 40)
            Dim template1 As Template = Template.CreateGridTemplate(New Cell() {gcTimeSpanCell1}, 160, AutoGenerateGridTemplateStyles.ColumnHeader Or AutoGenerateGridTemplateStyles.RowHeaderAutoNumber)

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

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

参照

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

 

 


© 2008-2015 GrapeCity inc. All rights reserved.