东莞建站响应式网站多少钱,秦皇岛网签合同查询,网页搜索如何屏蔽广告,公司装修效果图办公室这里写自定义目录标题 1. 工具栏: UcompToolStrip1.1 展示效果1.2 代码UcompToolStrip.csUcompToolStrip.Designer.cs 1. 工具栏: UcompToolStrip
自定义一些Winform组件
1.1 展示效果
1#xff09;使用效果 2#xff09;控件事件
1.2 代码
设计 编码
UcompToolStrip.… 这里写自定义目录标题 1. 工具栏: UcompToolStrip1.1 展示效果1.2 代码UcompToolStrip.csUcompToolStrip.Designer.cs 1. 工具栏: UcompToolStrip
自定义一些Winform组件
1.1 展示效果
1使用效果 2控件事件
1.2 代码
设计 编码
UcompToolStrip.cs public partial class UcompToolStrip : ToolStrip{// 定义委托类型public delegate void AddEventHandler(object sender, EventArgs e);public delegate void DeleteEventHandler(object sender, EventArgs e);public delegate void EditEventHandler(object sender, EventArgs e);public delegate void RefreshEventHandler(object sender, EventArgs e);public delegate void QueryEventHandler(object sender, EventArgs e);public delegate void QueryAdvEventHandler(object sender, EventArgs e);// 定义事件[Category(自定义事件)][Description(Button事件: 新增)]public event AddEventHandler UcEventOnAdd;[Category(自定义事件)][Description(Button事件: 删除)]public event DeleteEventHandler UcEventOnDelete;[Category(自定义事件)][Description(Button事件: 编辑)]public event EditEventHandler UcEventOnEdit;[Category(自定义事件)][Description(Button事件: 刷新)]public event RefreshEventHandler UcEventOnRefresh;[Category(自定义事件)][Description(Button事件: 查询)]public event QueryEventHandler UcEventOnQuery;[Category(自定义事件)][Description(Button事件: 高级查询)]public event QueryAdvEventHandler UcEventOnQueryAdv;public UcompToolStrip(){InitializeComponent();}public UcompToolStrip(IContainer container){container.Add(this);InitializeComponent();}// 为 ToolStripButton 添加 Click 事件处理程序 // 定义事件处理方法private void tsbtnAdd_Click(object sender, EventArgs e){ // 调用自定义事件UcEventOnAdd?.Invoke(this, e);// 在这里编写按钮点击时的逻辑//MessageBox.Show(新增);}private void tsbtnEdit_Click(object sender, EventArgs e){// 调用自定义事件UcEventOnEdit?.Invoke(this, e);}private void tsbtnDel_Click(object sender, EventArgs e){// 调用自定义事件UcEventOnDelete?.Invoke(this, e);}private void tsbtnRefresh_Click(object sender, EventArgs e){// 调用自定义事件UcEventOnRefresh?.Invoke(this, e);}private void tsbtnQuery_Click(object sender, EventArgs e){// 调用自定义事件UcEventOnQuery?.Invoke(this, e);}private void tsbtnQueryAdv_Click(object sender, EventArgs e){// 调用自定义事件UcEventOnQueryAdv?.Invoke(this, e);}}UcompToolStrip.Designer.cs
...... 省略this.toolStripSeparator2,this.tsbtnQueryAdv});this.Size new System.Drawing.Size(100, 34);this.ResumeLayout(false);// 增加按钮事件this.tsbtnAdd.Click new System.EventHandler(this.tsbtnAdd_Click);this.tsbtnEdit.Click new System.EventHandler(this.tsbtnEdit_Click);this.tsbtnDel.Click new System.EventHandler(this.tsbtnDel_Click);this.tsbtnRefresh.Click new System.EventHandler(this.tsbtnRefresh_Click);this.tsbtnQuery.Click new System.EventHandler(this.tsbtnQuery_Click);this.tsbtnQueryAdv.Click new System.EventHandler(this.tsbtnQueryAdv_Click);}#endregionprivate System.Windows.Forms.ToolStripButton tsbtnAdd;private System.Windows.Forms.ToolStripButton tsbtnEdit;private System.Windows.Forms.ToolStripButton tsbtnDel;private System.Windows.Forms.ToolStripButton tsbtnRefresh;private System.Windows.Forms.ToolStripButton tsbtnQuery;private System.Windows.Forms.ToolStripButton tsbtnQueryAdv;private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;private System.Windows.Forms.ToolStripLabel tslblKeyWord;private System.Windows.Forms.ToolStripTextBox tstxtInputKeyword; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;