c# 动态产生控件 注册动态控件事件
来源:互联网 发布:js 工作流引擎 编辑:程序博客网 时间:2024/05/20 02:23
用CheckEdit演示 其他控件类推
CheckEdit AllSele = new CheckEdit(); AllSele.Location = new System.Drawing.Point(10, 16); AllSele.Text = "全选"; this.groupBox5.Controls.Add(AllSele); AllSele.CheckedChanged += new EventHandler(AllSele_CheckedChanged); int i = 2; int x = 10; while (i < colCount) { CheckEdit cEt = new CheckEdit(); cEt.Location = new System.Drawing.Point(x += 75, 16); cEt.Text = dt.Columns[i].ColumnName; cEt.Name = cEt.Text; this.groupBox5.Controls.Add(cEt); cEt.CheckedChanged += new EventHandler(cEt_CheckedChanged); i++; }
下面是单选框值改变事件
/// <summary> /// 单选框处理事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cEt_CheckedChanged(object sender, EventArgs e) { CheckEdit ce = (CheckEdit)sender; if (flag) { //小数据 string te = ce.Name; //view.Columns[ce.Name + "_YB"].Name; //cpggcc.Visible = true; view.Columns["PART"].OwnerBand = cpccbw; view.Columns["GC"].OwnerBand = cpgcfw; GridBand band = cpggcc.Children.AddBand(ce.Name); band.Name = ce.Name; GridBand yqBand = band.Children.AddBand("要求"); GridBand ybBand = band.Children.AddBand("样板"); GridBand ybcc = ybBand.Children.AddBand("尺寸"); GridBand yqcc = yqBand.Children.AddBand("尺寸"); view.Columns[ce.Name].Visible = true; view.Columns[ce.Name+"xx"].Visible = true; view.Columns[ce.Name].OwnerBand = yqcc; view.Columns[ce.Name+"xx"].OwnerBand = ybcc; view.Columns[ce.Name + "xx"].OptionsColumn.AllowEdit = true; string[] temp = new string[30];//// for (int j1 = 0; j1 < view.Columns.Count; j1++) { temp[j1] = view.Columns[j1].Name; } StyleCenter(band); StyleCenter(yqBand); StyleCenter(ybBand); StyleCenter(yqcc); StyleCenter(ybcc); flag = false; } else if (ce.Checked) { GridBand band = cpggcc.Children.AddBand(ce.Name); band.Name = ce.Name; GridBand yqBand = band.Children.AddBand("要求"); GridBand ybBand = band.Children.AddBand("样板"); GridBand ybcc = ybBand.Children.AddBand("尺寸"); GridBand yqcc = yqBand.Children.AddBand("尺寸"); view.Columns[ce.Name].OwnerBand = yqcc; view.Columns[ce.Name].Visible = true; view.Columns[ce.Name + "xx"].Visible = true; view.Columns[ce.Name].OptionsColumn.AllowEdit = true; view.Columns[ce.Name].OwnerBand = yqcc; view.Columns[ce.Name + "xx"].OwnerBand = ybcc; view.Columns[ce.Name + "xx"].OptionsColumn.AllowEdit = true; StyleCenter(band); StyleCenter(yqBand); StyleCenter(ybBand); StyleCenter(yqcc); StyleCenter(ybcc); } else { cpggcc.Children.Remove(cpggcc.Children[ce.Name]); //移除gridBand } }
0 0
- c# 动态产生控件 注册动态控件事件
- c#动态生成控件,并为控件注册事件
- C#给控件动态添加事件
- 动态添加控件事件
- c# TableLayoutPanel控件应用 动态添加控件及事件
- c# TableLayoutPanel控件应用 动态添加控件及事件
- C# 动态创建控件
- c#动态添加控件
- c# 动态生成 控件
- C#动态生成控件
- C# 动态添加控件
- c#动态创建控件...
- 为控件动态添加事件
- 给动态控件添加事件
- asp.net 动态控件事件
- C#中动态创建控件及事件处理程序
- C#中动态创建控件及事件处理程序
- C#中动态创建控件及事件处理程序
- YII配置文件
- Linux查看系统cpu个数、核心书、线程数
- oracle 数据库表空间、数据文件及彼此间的联系
- javascript伪数组参数
- 黑马程序员_java基础二(线程和集合)
- c# 动态产生控件 注册动态控件事件
- JQuery中一个简单的表单验证的实例
- android tombstone
- Java Component类的常用方法
- arcgis for android 短路径分析 查找最短路径
- 写在大三将要结束之际
- 短信发送
- 你不了解PHP的10件事情
- oracle latch详解