如何在c#windows窗体中使用datetimepicker只读? [英] How to make datetimepicker readonly in c# windows forms?
本文介绍了如何在c#windows窗体中使用datetimepicker只读?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
how to make datetimepicker readonly in c# Windows Forms?
日期选择器可在winforms中编辑。但我希望它是不可编辑的模式...
怎么办?
我尝试过的:
Datetime picker is editable in winforms. but i want it t be non-editable mode...
How to do ?
What I have tried:
calVouFromDate.Format = DateTimePickerFormat.Custom;
calVouFromDate.CustomFormat = "dd-MMM-yyyy";
calVouToDate.Format = DateTimePickerFormat.Custom;
calVouToDate.CustomFormat = "dd-MMM-yyyy";
推荐答案
您可以设置控件的Enabled属性...
You could set the Enabled property of the control...
private void butDisable_Click(object sender, EventArgs e)
{
myDateTimePicker.Enabled = false;
}
private void butEnable_Click(object sender, EventArgs e)
{
myDateTimePicker.Enabled = true;
}
这篇关于如何在c#windows窗体中使用datetimepicker只读?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文