GrapeCity.Win.MultiRow.v80 アセンブリ > GrapeCity.Win.MultiRow.InputMan 名前空間 : GcNumberEditingControl クラス |
Public Class GcNumberEditingControl Inherits GrapeCity.Win.Editors.GcNumber Implements GrapeCity.Win.MultiRow.IEditingControl
public class GcNumberEditingControl : GrapeCity.Win.Editors.GcNumber, GrapeCity.Win.MultiRow.IEditingControl
GcNumberEditingControlクラスはGrapeCity.Win.MultiRow.IEditingControlインタフェースを実装する特殊化されたGcNumber で、セルが編集モードのときにCell内でホストできます。GcNumberEditingControlは、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プロパティによって返されたオブジェクトのプロパティを設定します。
using System; using System.Windows.Forms; using System.Drawing; using GrapeCity.Win.Editors; namespace GrapeCity.Win.MultiRow.InputMan.SampleCode { class GcNumberCellEditingControlDemo : Form { private GcMultiRow gcMultiRow1 = new GcMultiRow(); private Label label = new Label(); public GcNumberCellEditingControlDemo() { this.Text = "GcNumberCellEditingControl 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) { GcNumber control = e.Control as GcNumber; control.FieldEnter -= new EventHandler<FieldEventArgs>(control_FieldEnter); control.FieldEnter += new EventHandler<FieldEventArgs>(control_FieldEnter); control.FieldLeave -= new EventHandler<FieldEventArgs>(control_FieldLeave); control.FieldLeave += new EventHandler<FieldEventArgs>(control_FieldLeave); } void control_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 control_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) { GcNumberCell gcNumberCell1 = new GcNumberCell(); gcNumberCell1.Value = -12.55; gcNumberCell1.UseNegativeColor = false; gcNumberCell1.Size = new Size(120, 40); Template template1 = Template.CreateGridTemplate(new Cell[] { gcNumberCell1 }, 160, AutoGenerateGridTemplateStyles.ColumnHeader | AutoGenerateGridTemplateStyles.RowHeaderAutoNumber); gcMultiRow1.Template = template1; gcMultiRow1.RowCount = 3; } [STAThreadAttribute()] public static void Main() { Application.EnableVisualStyles(); Application.Run(new GcNumberCellEditingControlDemo()); } } }
Imports System Imports System.Windows.Forms Imports System.Drawing Imports GrapeCity.Win.Editors Namespace GrapeCity.Win.MultiRow.InputMan.SampleCode Class GcNumberCellEditingControlDemo Inherits Form Friend WithEvents gcMultiRow1 As New GcMultiRow() Private label As New Label() Public Sub New() Me.Text = "GcNumberCellEditingControl 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 control As GcNumber = TryCast(e.Control, GcNumber) RemoveHandler control.FieldEnter, AddressOf control_FieldEnter AddHandler control.FieldEnter, AddressOf control_FieldEnter RemoveHandler control.FieldLeave, AddressOf control_FieldLeave AddHandler control.FieldLeave, AddressOf control_FieldLeave End Sub Private Sub control_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 control_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 gcNumberCell1 As New GcNumberCell() gcNumberCell1.Value = -12.55 gcNumberCell1.UseNegativeColor = False gcNumberCell1.Size = New Size(120, 40) Dim template1 As Template = Template.CreateGridTemplate(New Cell() {gcNumberCell1}, 160, AutoGenerateGridTemplateStyles.ColumnHeader Or AutoGenerateGridTemplateStyles.RowHeaderAutoNumber) gcMultiRow1.Template = template1 gcMultiRow1.RowCount = 3 End Sub <STAThreadAttribute()> _ Public Shared Sub Main() Application.EnableVisualStyles() Application.Run(New GcNumberCellEditingControlDemo()) 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.GcNumberEditingControl