方法 : .NET Compact Framework で、DateTimePicker クラスを使用します。
[このドキュメントはプレビュー版であり、後のリリースで変更されることがあります。 空白のトピックは、プレースホルダーとして挿入されています。]
.NET Compact Framework DateTimePicker クラスをサポートするが、次のメンバーのみ。
CalendarFont プロパティ
CustomFormat プロパティ
Format プロパティ .NET Compact Framework DateTimePickerFormat 列挙型のすべての値をサポートします。
MaxDate プロパティ
MinDate プロパティ
ShowUpDown プロパティ
ValueChanged イベント。
OnValueChanged メソッド
使用注意してください OnValueChanged が指定されているため、派生クラスはこのメソッド イベント ハンドラー デリゲートを接続することがなく。 デリゲートの使用については、イベントの発生 を参照してください。
注意
Smartphone の DateTimePicker は Windows Mobile 5. 0 ソフトウェア Smartphone をしてください。値が、ナビゲーション キーで選択されているため、Smartphone 上のコントロールは、アップダウン セレクターを持ちません。
使用例
コード例を次に示しますは DateTimePicker コントロールを構成、 .NET Compact Framework ででく方法を示しています。
Private
Sub SetupDateTimePicker()
' Set the MinDate and MaxDate.
DateTimePicker1.MinDate = new DateTime(1985, 6, 12)
DateTimePicker1.MaxDate = DateTime.Today
'Set the format.
DateTimePicker1.Format = DateTimePickerFormat.Short
' Define a custom format.
DateTimePicker1.CustomFormat = "MMMM dd, yyyy - dddd"
' If you want to use the custom format, change ' DateTimePickerFormat.Short to DateTimePickerFormat.Custom.
' Display the control with the up-down selector.
DateTimePicker1.ShowUpDown = TrueEndSubPrivateSub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged
' Respond to changes, such as using ' the updated value in your application.EndSub
private
void SetupDateTimePicker()
{
// Set the MinDate and MaxDate.
dateTimePicker1.MinDate = new DateTime(1985, 6, 12);
dateTimePicker1.MaxDate = DateTime.Today;
// Set the format.
dateTimePicker1.Format = DateTimePickerFormat.Short;
// Define a custom format.
dateTimePicker1.CustomFormat = "MMMM dd, yyyy - dddd";
// If you want to use the custom format, change// DateTimePickerFormat.Short to DateTimePickerFormat.Custom.// Display the control with the up-down selector.
dateTimePicker1.ShowUpDown = true;
}
privatevoid dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
// Respond to changes, such as using// the updated value in your application.
}
コードのコンパイル方法
この例では、次の名前空間への参照が必要です。