C# 公共控件之 dateTimePicker

此控件用起来简单

public Form1()
{
    InitializeComponent();
    // Set the MinDate and MaxDate.
    dateTimePicker1.MinDate = new DateTime(1985, 6, 20);
    dateTimePicker1.MaxDate = DateTime.Today;

    // Set the CustomFormat string.
    dateTimePicker1.CustomFormat = "MMMM dd, yyyy - dddd";
    dateTimePicker1.Format = DateTimePickerFormat.Custom;

    // Show the CheckBox and display the control as an up-down control.
    dateTimePicker1.ShowCheckBox = true;
    dateTimePicker1.ShowUpDown = true;
}

private void button1_Click(object sender, EventArgs e)
{
    label1.Text = dateTimePicker1.Text;
}

猜你喜欢

转载自blog.csdn.net/zhuxipan1990/article/details/83090008