作成日: 2024/01/31 最終更新日: 2024/01/31
文書種別
使用方法
詳細
以下のような書式設定を行うことで、数値をゼロパディング表示することができます。
[Visual Basic]
[C#]
[Visual Basic]
Imports GrapeCity.Win.MultiRow
Imports GrapeCity.Win.MultiRow.InputMan
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'セル型の作成
Dim numberCell As New GcNumberCell
' 編集時の書式設定
numberCell.Fields.SetFields("###0,,,-,")
' 表示時の書式設定(ゼロパディング)
numberCell.DisplayFields.Clear()
numberCell.DisplayFields.AddRange("0000,,,-,")
' MultiRowの設定
GcMultiRow1.Template = Template.CreateGridTemplate(New Cell() {numberCell})
GcMultiRow1.RowCount = 5
' テストデータの設定
GcMultiRow1.SetValue(0, 0, 5)
End Sub
End Class
[C#]
using GrapeCity.Win.MultiRow.InputMan;
using GrapeCity.Win.MultiRow;
namespace sample
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// セル型の作成
GcNumberCell numberCell = new GcNumberCell();
// 編集時の書式設定
numberCell.Fields.SetFields("###0,,,-,");
// 表示時の書式設定(ゼロパディング)
numberCell.DisplayFields.Clear();
numberCell.DisplayFields.AddRange("0000,,,-,");
// MultiRowの設定
gcMultiRow1.Template = Template.CreateGridTemplate(new Cell[] { numberCell });
gcMultiRow1.RowCount = 5;
// テストデータの設定
gcMultiRow1.SetValue(0, 0, 5);
}
}
}