我想在 StatusStrip 控件中添加一个 datetimepicker 以显示今天的日期,那么除了标签和进度条之外,还有什么方法可以将其他控件添加到 StatusStrip 控件中?
问问题
1100 次
1 回答
0
是的,请从以下位置检查:
[ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.ToolStrip)]
public class ToolStripDateTimePicker : ToolStripControlHost
{
private FlowLayoutPanel controlPanel;
private DateTimePicker picker = new DateTimePicker();
public ToolStripDateTimePicker()
: base(new FlowLayoutPanel())
{
controlPanel = (FlowLayoutPanel)base.Control;
controlPanel.BackColor = Color.Transparent;
AutoSize = false;
controlPanel.Controls.Add(picker);
}
public DateTime Value
{
get { return this.picker.Value; }
set { this.picker.Value = value; }
}
protected override void OnSubscribeControlEvents(Control control)
{
base.OnSubscribeControlEvents(control);
}
protected override void OnUnsubscribeControlEvents(Control control)
{
base.OnUnsubscribeControlEvents(control);
}
}
于 2015-09-02T09:57:13.813 回答