C# 公共控制元件之 dateTimePicker
阿新 • • 發佈:2018-11-10
此控制元件用起來簡單
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; }