PowerTools MultiRow for Windows Forms 8.0J
書式設定済みの値の取得

DateTimePickerCellはDateTimePickerCell.Style.Formatプロパティをサポートしていないため、DateTimePickerCell.FormattedValueプロパティはDateTimePickerCell.FormatプロパティやDateTimePickerCell.CustomFormatプロパティの値に関係なく常にDateTimePickerCell.Valueプロパティの値の文字列を返します。(例:9998/12/31 00:00:00)
DateTimePickerCellの値を書式付で取得するには、Cell.DisplayTextプロパティまたはGcMultiRow.GetDisplayTextメソッドを使用します。
サンプルコード
Imports GrapeCity.Win.MultiRow

Dim DateTimePickerCell1 As New DateTimePickerCell()
DateTimePickerCell1.Format = DateTimePickerFormat.Short
DateTimePickerCell1.Value = DateTime.Now

Dim Template1 As Template = Template.CreateGridTemplate(New Cell() {DateTimePickerCell1})
GcMultiRow1.Template = Template1
GcMultiRow1.CurrentCellPosition = New CellPosition(0, 0)

Console.WriteLine("書式設定済みの値1: {0}", GcMultiRow1.GetDisplayText(GcMultiRow1.CurrentCellPosition.RowIndex, GcMultiRow1.CurrentCellPosition.CellIndex))
Console.WriteLine("書式設定済みの値2: {0}", GcMultiRow1.CurrentCell.DisplayText)
Console.WriteLine("セルの値: {0}", GcMultiRow1.CurrentCell.FormattedValue.ToString())
using GrapeCity.Win.MultiRow;

DateTimePickerCell dateTimePickerCell1 = new DateTimePickerCell();
dateTimePickerCell1.Format = DateTimePickerFormat.Short;
dateTimePickerCell1.Value = DateTime.Now;

Template template1 = Template.CreateGridTemplate(new Cell[] { dateTimePickerCell1 });
gcMultiRow1.Template = template1;
gcMultiRow1.CurrentCellPosition = new CellPosition(0, 0);

Console.WriteLine("書式設定済みの値1: {0}", gcMultiRow1.GetDisplayText(gcMultiRow1.CurrentCellPosition.RowIndex, gcMultiRow1.CurrentCellPosition.CellIndex));
Console.WriteLine("書式設定済みの値2: {0}", gcMultiRow1.CurrentCell.DisplayText);
Console.WriteLine("セルの値: {0}", gcMultiRow1.CurrentCell.FormattedValue.ToString());
   
参照

 

 


© 2008-2015 GrapeCity inc. All rights reserved.