请高人指点 非常紧急啊 多帮忙 你可以用每个按钮的Tag属性记录每个按钮的唯一信息,然后在删除的时候,对按钮遍历,找符合条件的Tag信息的按钮进行删除即可。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 void buttonClick(object sender, System.EventArgs e){ foreach (Control cc in this.Controls) { if (cc.Focused==true) cc.Dispose(); }} 把下面事件挂在你添加的按钮上private void button_Click(object sender, System.EventArgs e){ Button btn = sender as Button; btn.Dispose();} private void button1_Click(object sender,System.EventArgs e) { if(x>=350) {x=-2; y+=30;} this.temp = new System.Windows.Forms.Button(); temp.Location=new Point(x,y); temp.Size = new System.Drawing.Size(80, 30); this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {this.temp}); x+=80; } 这是小弟写的程序 每次都生成叫temp的按钮 那么froeach语句的的时候 那个数组在哪呢 还有 这里所有的按钮都叫temp 不重复或者只有一个呢 高手们请指点 完成这个工作 我就可以休息了 给分 那么你可以这样做:首先在你的代码里再添加这样一条语句,例如添加在temp.Size = new System.Drawing.Size(80, 30);这条语句后面:temp.Click += new System.EventHandler(this.bb_Click);然后加进这个函数就可实现你要的功能了:private void bb_Click(object sender, System.EventArgs e){ Button bb=(Button)sender; this.groupBox1.Controls.Remove(bb);} C#特效 关于mysql操作的问题 不知哪位高手可以帮忙解决这个问题!!! 随着Form的改变而改变相同比例的Form中的控件(哪位兄弟有写好的类,给共享一下) 关于网页内容不让抓取的问题 图标恢复问题 com序列化 在 C# 中使用 SevenZipCompressor 如何将文件列表直接写进压缩流 c# 时钟 多线程 请大家来谈谈.net 产生乱码的原因和解决的办法 不知道怎样调用msdn里面的例子函数!!!!在线等待!!!! 在用DataSet.Update()无法更新数据的问题
{
foreach (Control cc in this.Controls)
{
if (cc.Focused==true)
cc.Dispose();
}
}
private void button_Click(object sender, System.EventArgs e)
{
Button btn = sender as Button;
btn.Dispose();
}
{
if(x>=350)
{x=-2;
y+=30;}
this.temp = new System.Windows.Forms.Button();
temp.Location=new Point(x,y);
temp.Size = new System.Drawing.Size(80, 30);
this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {this.temp});
x+=80;
}
这是小弟写的程序 每次都生成叫temp的按钮 那么froeach语句的的时候 那个数组在哪呢 还有 这里所有的按钮都叫temp 不重复或者只有一个呢 高手们请指点 完成这个工作 我就可以休息了 给分
首先在你的代码里再添加这样一条语句,例如添加在
temp.Size = new System.Drawing.Size(80, 30);
这条语句后面:
temp.Click += new System.EventHandler(this.bb_Click);
然后加进这个函数就可实现你要的功能了:private void bb_Click(object sender, System.EventArgs e)
{
Button bb=(Button)sender;
this.groupBox1.Controls.Remove(bb);
}