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

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

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

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

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

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

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

            this.label.Dock = DockStyle.Bottom;
            this.label.Height = 50;
            this.label.BackColor = SystemColors.Info;
            this.label.Text = "In edit mode, open the editor's DropDown, input some text in DropDown, switch the focus from DropDown to other place, the value will be committed to editor; By default, you should hit ENTER key to commit value.";
            this.Controls.Add(label);

            this.Load += new EventHandler(Form1_Load);

            this.StartPosition = FormStartPosition.CenterScreen;
        }

        private void gcMultiRow1_EditingControlShowing(object sender, EditingControlShowingEventArgs e)
        {
            GcTextBox gcTextBox1 = e.Control as GcTextBox;
            gcTextBox1.DropDownClosing -= new EventHandler<DropDownClosingEventArgs>(gcTextBox1_DropDownClosing);
            gcTextBox1.DropDownClosing += new EventHandler<DropDownClosingEventArgs>(gcTextBox1_DropDownClosing);
        }

        void gcTextBox1_DropDownClosing(object sender, DropDownClosingEventArgs e)
        {
            //When the focus leave from the GcTextBox.DrowDown, the value will be committed to editor.
            e.SyncData = true;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            GcTextBoxCell gcTextBoxCell1 = new GcTextBoxCell();
            Template template1 = Template.CreateGridTemplate(new Cell[] { gcTextBoxCell1 }, 160,
                AutoGenerateGridTemplateStyles.ColumnHeader | AutoGenerateGridTemplateStyles.RowHeaderAutoNumber);

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

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

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

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

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

            Me.label.Dock = DockStyle.Bottom
            Me.label.Height = 60
            Me.label.BackColor = SystemColors.Info
            Me.label.Text = "In edit mode, open the editor's DropDown, input some text in DropDown, switch the focus from DropDown to other place, the value will be committed to editor; By default, you should hit ENTER key to commit value."
            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 gcTextBox1 As GcTextBox = TryCast(e.Control, GcTextBox)
            RemoveHandler gcTextBox1.DropDownClosing, AddressOf gcTextBox1_DropDownClosing
            AddHandler gcTextBox1.DropDownClosing, AddressOf gcTextBox1_DropDownClosing
        End Sub

        Private Sub gcTextBox1_DropDownClosing(ByVal sender As Object, ByVal e As DropDownClosingEventArgs)
            'When the focus leave from the GcTextBox.DrowDown, the value will be committed to editor.
            e.SyncData = True
        End Sub

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
            Dim gcTextBoxCell1 As New GcTextBoxCell()
            Dim template1 As Template = Template.CreateGridTemplate(New Cell() {gcTextBoxCell1}, 160, AutoGenerateGridTemplateStyles.ColumnHeader Or AutoGenerateGridTemplateStyles.RowHeaderAutoNumber)

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

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

参照

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

 

 


© 2008-2015 GrapeCity inc. All rights reserved.