GrapeCity.Win.MultiRow.v80 アセンブリ > GrapeCity.Win.MultiRow.InputMan 名前空間 : GcNumberCell クラス |
Public Class GcNumberCell Inherits FieldsEditorCell
public class GcNumberCell : FieldsEditorCell
using System; using System.Windows.Forms; using System.Drawing; namespace GrapeCity.Win.MultiRow.InputMan.SampleCode { class GcNumberCellDemo : Form { private GcMultiRow gcMultiRow1 = new GcMultiRow(); private Label label = new Label(); public GcNumberCellDemo() { this.Text = "GcNumberCell Demo"; this.Size = new Size(350, 300); // Add MultiRow to form this.gcMultiRow1.Dock = DockStyle.Fill; this.Controls.Add(this.gcMultiRow1); this.label.Dock = DockStyle.Bottom; this.label.Height = 50; this.label.BackColor = SystemColors.Info; this.label.Text = " Enter edit mode, and click the SpinButton to modify the each field value, you can use the Alt+Substract to switch the sign, exits the edit mode, only the integral part will display."; this.Controls.Add(label); this.Load += new EventHandler(Form1_Load); this.StartPosition = FormStartPosition.CenterScreen; } private void Form1_Load(object sender, EventArgs e) { GcNumberCell gcNumberCell1 = new GcNumberCell(); SetGcNumberCellDisplayFields(gcNumberCell1); SetShortcutsAndSideButtons(gcNumberCell1); Template template1 = Template.CreateGridTemplate(new Cell[] { gcNumberCell1, gcNumberCell1.Clone() as Cell }, 200, AutoGenerateGridTemplateStyles.ColumnHeader | AutoGenerateGridTemplateStyles.RowHeaderAutoNumber); gcMultiRow1.Template = template1; gcMultiRow1.RowCount = 3; } private void SetGcNumberCellDisplayFields(GcNumberCell gcNumberCell1) { gcNumberCell1.DisplayFields.Clear(); NumberSignDisplayField numberSignDisplayField1 = new NumberSignDisplayField(); NumberIntegerPartDisplayField numberIntegerPartDisplayField1 = new NumberIntegerPartDisplayField(); numberIntegerPartDisplayField1.GroupSizes = new int[] {0}; numberIntegerPartDisplayField1.MinDigits = 0; gcNumberCell1.DisplayFields.AddRange(new NumberDisplayField[] { numberSignDisplayField1, numberIntegerPartDisplayField1 }); } private void SetShortcutsAndSideButtons(GcNumberCell gcNumberCell1) { //In edit mode, hit the Alt+Subtract to switch the sign. gcNumberCell1.ShortcutKeys.Add(Keys.Alt | Keys.Subtract, "SwitchSign"); gcNumberCell1.ShortcutKeys.Add(Keys.Alt | Keys.OemMinus, "SwitchSign"); gcNumberCell1.SideButtons.Clear(); gcNumberCell1.SideButtons.Add(new SpinButton()); } [STAThreadAttribute()] public static void Main() { Application.EnableVisualStyles(); Application.Run(new GcNumberCellDemo()); } } }
Imports System Imports System.Windows.Forms Imports System.Drawing Namespace GrapeCity.Win.MultiRow.InputMan.SampleCode Class GcNumberCellDemo Inherits Form Private gcMultiRow1 As New GcMultiRow() Private label As New Label() Public Sub New() Me.Text = "GcNumberCell 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 = 50 Me.label.BackColor = SystemColors.Info Me.label.Text = " Enter edit mode, and click the SpinButton to modify the each field value, you can use the Alt+Substract to switch the sign, exits the edit mode, only the integral part will display." Me.Controls.Add(label) Me.StartPosition = FormStartPosition.CenterScreen End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load Dim gcNumberCell1 As New GcNumberCell() SetGcNumberCellDisplayFields(gcNumberCell1) SetShortcutsAndSideButtons(gcNumberCell1) Dim template1 As Template = Template.CreateGridTemplate(New Cell() {gcNumberCell1, TryCast(gcNumberCell1.Clone(), Cell)}, 200, AutoGenerateGridTemplateStyles.ColumnHeader Or AutoGenerateGridTemplateStyles.RowHeaderAutoNumber) gcMultiRow1.Template = template1 gcMultiRow1.RowCount = 3 End Sub Private Sub SetGcNumberCellDisplayFields(ByVal gcNumberCell1 As GcNumberCell) gcNumberCell1.DisplayFields.Clear() Dim numberSignDisplayField1 As New NumberSignDisplayField() Dim numberIntegerPartDisplayField1 As New NumberIntegerPartDisplayField() numberIntegerPartDisplayField1.GroupSizes = New Integer() {0} numberIntegerPartDisplayField1.MinDigits = 0 gcNumberCell1.DisplayFields.AddRange(New NumberDisplayField() {numberSignDisplayField1, numberIntegerPartDisplayField1}) End Sub Private Sub SetShortcutsAndSideButtons(ByVal gcNumberCell1 As GcNumberCell) 'In edit mode, hit the Alt+Subtract to switch the sign. gcNumberCell1.ShortcutKeys.Add(Keys.Alt Or Keys.Subtract, "SwitchSign") gcNumberCell1.ShortcutKeys.Add(Keys.Alt Or Keys.OemMinus, "SwitchSign") gcNumberCell1.SideButtons.Clear() gcNumberCell1.SideButtons.Add(New SpinButton()) End Sub <STAThreadAttribute()> _ Public Shared Sub Main() Application.EnableVisualStyles() Application.Run(New GcNumberCellDemo()) 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.GcNumberCell