ToolStrip动态添加自定义控件
2008-11-06 23:36
225 查看
ToolStripControlHost dateTimePickerHost;
private void InitializeDateTimePickerHost()
{
// Create a new ToolStripControlHost, passing in a control.
dateTimePickerHost = new ToolStripControlHost(new DateTimePicker());
// Set the font on the ToolStripControlHost, this will affect the hosted control.
dateTimePickerHost.Font = new Font("Arial", 7.0F, FontStyle.Italic);
// Set the Width property, this will also affect the hosted control.
dateTimePickerHost.Width = 100;
dateTimePickerHost.DisplayStyle = ToolStripItemDisplayStyle.Text;
// Setting the Text property requires a string that converts to a
// DateTime type since that is what the hosted control requires.
dateTimePickerHost.Text = "12/23/2005";
// Cast the Control property back to the original type to set a
// type-specific property.
((DateTimePicker)dateTimePickerHost.Control).Format = DateTimePickerFormat.Short;
// Add the control host to the ToolStrip.
toolStrip1.Items.Add(dateTimePickerHost);
}
列:
ToolStripControlHost toolStripControlHost = new ToolStripControlHost(new Button.DJGridSetButton());
//Button.DJGridSetButton djBtn = new ZF_ERP.Button.DJGridSetButton();
((Button.DJGridSetButton)toolStripControlHost.Control).GridID = m_FormID;
((Button.DJGridSetButton)toolStripControlHost.Control).FormID = m_FormID;
((Button.DJGridSetButton)toolStripControlHost.Control).Text = "单据表格设置";
toolStrip.Items.Add(toolStripControlHost);
private void InitializeDateTimePickerHost()
{
// Create a new ToolStripControlHost, passing in a control.
dateTimePickerHost = new ToolStripControlHost(new DateTimePicker());
// Set the font on the ToolStripControlHost, this will affect the hosted control.
dateTimePickerHost.Font = new Font("Arial", 7.0F, FontStyle.Italic);
// Set the Width property, this will also affect the hosted control.
dateTimePickerHost.Width = 100;
dateTimePickerHost.DisplayStyle = ToolStripItemDisplayStyle.Text;
// Setting the Text property requires a string that converts to a
// DateTime type since that is what the hosted control requires.
dateTimePickerHost.Text = "12/23/2005";
// Cast the Control property back to the original type to set a
// type-specific property.
((DateTimePicker)dateTimePickerHost.Control).Format = DateTimePickerFormat.Short;
// Add the control host to the ToolStrip.
toolStrip1.Items.Add(dateTimePickerHost);
}
列:
ToolStripControlHost toolStripControlHost = new ToolStripControlHost(new Button.DJGridSetButton());
//Button.DJGridSetButton djBtn = new ZF_ERP.Button.DJGridSetButton();
((Button.DJGridSetButton)toolStripControlHost.Control).GridID = m_FormID;
((Button.DJGridSetButton)toolStripControlHost.Control).FormID = m_FormID;
((Button.DJGridSetButton)toolStripControlHost.Control).Text = "单据表格设置";
toolStrip.Items.Add(toolStripControlHost);
相关文章推荐
- ASP.NET 动态添加自定义控件
- 动态添加自定义控件:即按一下Botton添加一个UseControl,再按一下又添加一个
- 关于动态添加的自定义控件的问题
- 关于动态添加自定义控件的使用心得
- 向ToolStrip、MenuStrip、StatusStrip中添加自定义控件
- datagrid 动态添加自定义控件方法!
- ASP.NET 动态添加自定义控件
- 动态添加自定义控件
- C#在控件上有序地动态添加自定义控件
- 笔记98--自定义控件示例1:仿小米添加联系人(动态改变行数)
- 疑问:AddWebPart 不能添加动态加载的自定义控件吗?
- WPF--自定义控件的动态添加以及BackgroundWorker的使用
- VB.NET2005 动态添加 ToolStrip 控件
- VB 2005 Toolstrip动态添加菜单
- Android-->View.setX()和.setY()的使用(移动布局,设置布局位置,动态添加View)
- form表单 无法提交js动态添加的表单元素遇到的坑
- 动态添加删除Spinner
- JavaScript对象动态添加属性
- scroolview 动态添加view
- 为ToolBarManager添加自定义控件