C# 公共控件之 dateTimePicker

Posted 无声蝉

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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;

以上是关于C# 公共控件之 dateTimePicker的主要内容,如果未能解决你的问题,请参考以下文章

c# winform的dateTimePicker控件的日历面板的字体怎么调大?

C# 公共控件之pictureBox

C# 公共控件之maskedTextBox

C# DateTimePicker控件如何精确设置显示时分秒

C# DateTimePicker控件如何精确设置显示时分秒

C# 公共控件之ListView