PowerTools PlusPak for Windows Forms 8.0J
GetRokuyou メソッド
使用例 

六曜を取得する対象の日付
特定の日付の六曜を取得します。
構文
Public Function GetRokuyou( _
   ByVal date As Date _
) As Rokuyous
public Rokuyous GetRokuyou( 
   DateTime date
)

パラメータ

date
六曜を取得する対象の日付

戻り値の型

日付に対応する六曜
使用例
次のサンプルコードは、選択した日付の六曜を取得する方法を示します。
Private Sub GcCalendar1_SelectedDateChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GcCalendar1.SelectedDateChanged
    Dim selectedDate As GrapeCity.Win.Calendar.DateTimeEx = Me.GcCalendar1.SelectedDate
    If Not selectedDate Is Nothing Then
        Dim rokuyou As String = ""
        Select Case Me.GcCalendar1.GetRokuyou(selectedDate)
            Case GrapeCity.Win.Calendar.Rokuyous.Butsumetsu
                rokuyou = "仏滅"
            Case GrapeCity.Win.Calendar.Rokuyous.None
                rokuyou = "なし"
            Case GrapeCity.Win.Calendar.Rokuyous.Senbu
                rokuyou = "先負"
            Case GrapeCity.Win.Calendar.Rokuyous.Senshou
                rokuyou = "先勝"
            Case GrapeCity.Win.Calendar.Rokuyous.Shakkou
                rokuyou = "赤口"
            Case GrapeCity.Win.Calendar.Rokuyous.Taian
                rokuyou = "大安"
            Case GrapeCity.Win.Calendar.Rokuyous.Tomobiki
                rokuyou = "友引"
        End Select
        Me.Label1.Text = String.Format("{0}, {1}", selectedDate.ToLongDateString(), rokuyou)
    End If
End Sub
private void gcCalendar1_SelectedDateChanged(object sender, EventArgs e)
{
    GrapeCity.Win.Calendar.DateTimeEx selectedDate = this.gcCalendar1.SelectedDate;
    if (selectedDate != null)
    {
        string rokuyou = "";
        switch (this.gcCalendar1.GetRokuyou(selectedDate))
        {
            case GrapeCity.Win.Calendar.Rokuyous.Butsumetsu:
                rokuyou = "仏滅";
                break;
            case GrapeCity.Win.Calendar.Rokuyous.None:
                rokuyou = "なし";
                break;
            case GrapeCity.Win.Calendar.Rokuyous.Senbu:
                rokuyou = "先負";
                break;
            case GrapeCity.Win.Calendar.Rokuyous.Senshou:
                rokuyou = "先勝";
                break;
            case GrapeCity.Win.Calendar.Rokuyous.Shakkou:
                rokuyou = "赤口";
                break;
            case GrapeCity.Win.Calendar.Rokuyous.Taian:
                rokuyou = "大安";
                break;
            case GrapeCity.Win.Calendar.Rokuyous.Tomobiki:
                rokuyou = "友引";
                break;
            default:
                break;
        }
        this.label1.Text = string.Format("{0}, {1}", selectedDate.ToLongDateString(), rokuyou);
    }
}
プラットフォーム

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

参照

GcCalendar クラス
GcCalendar メンバ

Send Feedback