MESCIUS SPREAD for Windows Forms 17.0J
MonthNames プロパティ (DateTimeCellType)

コントロールの月の別名の短縮形を取得または設定します(UserDefinedFormat で使用)。
構文
'Declaration
 
Public Property MonthNames As String()
public string[] MonthNames {get; set;}

プロパティ値

月名を含む String の配列
解説

これは個々のセルに適用できます。書式が UserDefined で、短い形式の2つのプロパティが "ddd MMM"、長い形式の2つのプロパティが "dddd MMMM" の場合のみ効果があります。

このプロパティでは、配列は正確に 13 個の要素を持つ1次元配列である必要があります。

月名を含む1次元の文字列配列の詳細については、Microsoft .NET Framework ドキュメントの MonthNames を参照してください。

次のサンプルコードは、書式が"dddd MMMM d, yyyy"の場合に曜日名と月名に使用する文字列を指定します。
FarPoint.Win.Spread.CellType.DateTimeCellType dt = new FarPoint.Win.Spread.CellType.DateTimeCellType();
string[] dNames = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
string[] mNames = {"Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec",""};
string[] sdNames = {"SU", "M", "T", "W", "TH", "F", "S"};
string[] smNames = {"J", "F", "M", "A", "MY", "J", "JY", "AG", "S", "O", "N", "D",""};
string okbutn = "Accept";
string canbutn = "Decline";
dt.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.UserDefined;
dt.UserDefinedFormat = "dddd  MMMM d,  yyyy";
dt.DayNames = dNames;
dt.MonthNames = mNames;
dt.ShortDayNames = sdNames;
dt.ShortMonthNames = smNames;
dt.SetCalendarText(okbutn, canbutn);
fpSpread1.ActiveSheet.Cells[0, 0].CellType = dt;
fpSpread1.ActiveSheet.Cells[0, 0].Value = System.DateTime.Now;
fpSpread1.ActiveSheet.Columns[0].Width = 130;
Dim dt As New FarPoint.Win.Spread.CellType.DateTimeCellType()
Dim dNames() As String = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}
Dim mNames() As String = {"Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec",""}
Dim sdNames() As String = {"SU", "M", "T", "W", "TH", "F", "S"}
Dim smNames() As String = {"J", "F", "M", "A", "MY", "J", "JY", "AG", "S", "O", "N", "D",""}
Dim okbutn As String = "Accept"
Dim canbutn As String = "Decline"
dt.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.UserDefined
dt.UserDefinedFormat = "dddd  MMMM d,  yyyy"
dt.DayNames = dNames
dt.MonthNames = mNames
dt.ShortDayNames = sdNames
dt.ShortMonthNames = smNames
dt.SetCalendarText(okbutn, canbutn)
fpSpread1.ActiveSheet.Cells(0, 0).CellType = dt
fpSpread1.ActiveSheet.Cells(0, 0).Value = Now
fpSpread1.ActiveSheet.Columns(0).Width = 130
参照

DateTimeCellType クラス
DateTimeCellType メンバ

 

 


© MESCIUS inc. All rights reserved.