C# toolstrip 上新增DateTimePicker Control控制元件

園封記憶發表於2013-07-26

private void AddDTPtoToolstrip( n)
{
DateTimePicker dtp = DateTimePicker;
dtp.Width = 110;
dtp.Format = DateTimePickerFormat.Custom;
ToolStripControlHost host1 = ToolStripControlHost(dtp);
toolStrip1.Items.Insert(n, host1);
}

得到 DateTimePicker 值:
toolStrip1.Items[0].Text.; //得到index = 0Control控制元件值

相關文章