ToolStrip上面添加时间
2016-06-08 16:46:19 访问(1874) 赞(0) 踩(0)
int idx
=
cu.ToolStripFindToolStripItemIndex
(
ts,
toolStripLabel_时间
);
DateTime dtNow = DateTime.Now;
dtpStartTime = new DateTimePicker();
dtpEndTime = new DateTimePicker();
dtpStartDate = new DateTimePicker();
dtpEndDate = new DateTimePicker();
dtpStartTime.Text = "00:00:00";
dtpStartTime.Width = 75;
ToolStripControlHost hhTime = new ToolStripControlHost(dtpStartTime);
dtpStartDate.Text = dtNow.ToString("yyyy-MM-dd");
dtpStartDate.Width = 110;
ToolStripControlHost hhDate = new ToolStripControlHost(dtpStartDate);
dtpStartDate.Format = DateTimePickerFormat.Long;
dtpEndDate.Format = DateTimePickerFormat.Long;
dtpStartTime.Format = DateTimePickerFormat.Time;
dtpEndTime.Format = DateTimePickerFormat.Time;
dtpStartTime.ShowUpDown = true;
dtpEndTime.ShowUpDown = true;
ts.Items.Insert(idx + 1, hhDate);
ts.Items.Insert(idx + 2, hhTime);
idx =
cu.ToolStripFindToolStripItemIndex
(
ts,
toolStripLabel_时间至
);
dtpEndTime.Text = dtNow.ToString("HH:mm:ss");
dtpEndTime.Width = 75;
hhTime = new ToolStripControlHost(dtpEndTime);
dtpEndDate.Text = dtNow.ToString("yyyy-MM-dd");
dtpEndDate.Width = 110;
hhDate = new ToolStripControlHost(dtpEndDate);
ts.Items.Insert(idx + 1, hhDate);
ts.Items.Insert(idx + 2, hhTime);
标签:
ToolStrip上面添加时间 


上一条:
下一条:
相关评论
发表评论