GrapeCity CalendarGrid for Windows Forms 2.0J
DateFormatInfo プロパティ
使用例 

GcCalendarGridCalendarDateFormatInfo を取得します。この日付書式は、ビュー内の日付のレイアウト、および CalendarCellSystem.DateTime の書式設定されたテキストに影響します。
構文
Public ReadOnly Property DateFormatInfo As CalendarDateFormatInfo
public CalendarDateFormatInfo DateFormatInfo {get;}

プロパティ値

日付書式に関する設定を含む CalendarDateFormatInfo
使用例
次のサンプルコードは、CalendarDateFormatInfo のカスタマイズ方法を示します。
private void CustomDateFormatInfo()
{
    DateTime date = new DateTime(2014, 2, 14);

    this.gcCalendarGrid1.DateFormatInfo.CultureInfo = new CultureInfo("en-US");
    Console.WriteLine(this.gcCalendarGrid1.DateFormatInfo.FormatDate(date, CalendarDateFormats.LongDate, CalendarDateFormatType.CalendarGrid));
    // Output "Friday, February 14, 2014"

    this.gcCalendarGrid1.DateFormatInfo.CultureInfo = new CultureInfo("ja-JP");
    Console.WriteLine(this.gcCalendarGrid1.DateFormatInfo.FormatDate(date, CalendarDateFormats.LongDate, CalendarDateFormatType.CalendarGrid));
    // Output "2014年2月14日"

    this.gcCalendarGrid1.DateFormatInfo.CalendarWeekRule = CalendarWeekRule.FirstDay;
    this.gcCalendarGrid1.DateFormatInfo.FirstDayOfWeek = DayOfWeek.Sunday;
    Console.WriteLine(this.gcCalendarGrid1.DateFormatInfo.FormatDate(date, CalendarDateFormats.WeekNumber, CalendarDateFormatType.CalendarGrid));
    // Output "7"

    this.gcCalendarGrid1.DateFormatInfo.CalendarWeekRule = CalendarWeekRule.FirstFullWeek;
    this.gcCalendarGrid1.DateFormatInfo.FirstDayOfWeek = DayOfWeek.Monday;
    Console.WriteLine(this.gcCalendarGrid1.DateFormatInfo.FormatDate(date, CalendarDateFormats.WeekNumber, CalendarDateFormatType.CalendarGrid));
    // Output "6"

    this.gcCalendarGrid1.DateFormatInfo.DayOfWeekNames = "Sun(日),Mon(月),Tue(火),Wed(水),Thu(木),Fri(金),Sat(土)";
    Console.WriteLine(this.gcCalendarGrid1.DateFormatInfo.FormatDate(date, CalendarDateFormats.DayOfWeek, CalendarDateFormatType.CalendarGrid));
    // Output "Fri(金)"

    this.gcCalendarGrid1.DateFormatInfo.RokuyouNames = "Taian,Syakkou,Sensyou,Tomobiki,Senbu,Butumetu";
    Console.WriteLine(this.gcCalendarGrid1.DateFormatInfo.FormatDate(date, CalendarDateFormats.Rokuyou, CalendarDateFormatType.CalendarGrid));
    // Output "Senbu"
}
Private Sub CustomDateFormatInfo()
    Dim [date] As New DateTime(2014, 2, 14)

    Me.gcCalendarGrid1.DateFormatInfo.CultureInfo = New CultureInfo("en-US")
    Console.WriteLine(Me.gcCalendarGrid1.DateFormatInfo.FormatDate([date], CalendarDateFormats.LongDate, CalendarDateFormatType.CalendarGrid))
    ' Output "Friday, February 14, 2014"

    Me.gcCalendarGrid1.DateFormatInfo.CultureInfo = New CultureInfo("ja-JP")
    Console.WriteLine(Me.gcCalendarGrid1.DateFormatInfo.FormatDate([date], CalendarDateFormats.LongDate, CalendarDateFormatType.CalendarGrid))
    ' Output "2014年2月14日"

    Me.gcCalendarGrid1.DateFormatInfo.CalendarWeekRule = CalendarWeekRule.FirstDay
    Me.gcCalendarGrid1.DateFormatInfo.FirstDayOfWeek = DayOfWeek.Sunday
    Console.WriteLine(Me.gcCalendarGrid1.DateFormatInfo.FormatDate([date], CalendarDateFormats.WeekNumber, CalendarDateFormatType.CalendarGrid))
    ' Output "7"

    Me.gcCalendarGrid1.DateFormatInfo.CalendarWeekRule = CalendarWeekRule.FirstFullWeek
    Me.gcCalendarGrid1.DateFormatInfo.FirstDayOfWeek = DayOfWeek.Monday
    Console.WriteLine(Me.gcCalendarGrid1.DateFormatInfo.FormatDate([date], CalendarDateFormats.WeekNumber, CalendarDateFormatType.CalendarGrid))
    ' Output "6"

    Me.gcCalendarGrid1.DateFormatInfo.DayOfWeekNames = "Sun(日),Mon(月),Tue(火),Wed(水),Thu(木),Fri(金),Sat(土)"
    Console.WriteLine(Me.gcCalendarGrid1.DateFormatInfo.FormatDate([date], CalendarDateFormats.DayOfWeek, CalendarDateFormatType.CalendarGrid))
    ' Output "Fri(金)"

    Me.gcCalendarGrid1.DateFormatInfo.RokuyouNames = "Taian,Syakkou,Sensyou,Tomobiki,Senbu,Butumetu"
    Console.WriteLine(Me.gcCalendarGrid1.DateFormatInfo.FormatDate([date], CalendarDateFormats.Rokuyou, CalendarDateFormatType.CalendarGrid))
    ' Output "Senbu"
End Sub
参照

GcCalendarGrid クラス
GcCalendarGrid メンバ
DateFormat プロパティ
DateFormatType プロパティ
DateFormat プロパティ
DateFormatType プロパティ
DateFormat プロパティ
DateFormatType プロパティ
DateFormat プロパティ
DateFormatType プロパティ

 

 


c 2008 GrapeCity inc. All rights reserved.