按钮隐藏

woaizhonguoren 2010-01-25 10:51:27
动态生成一窗体的 按钮 先点一个按钮 出去他的text值 再点一个出去text值 进行比较 值相同 就把练个按钮隐藏
...全文
93 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
沐浴-vip 2010-01-25
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 wuyq11 的回复:]
在but_Click事件中
Button btn=sender as Button;
变量保存值,设置visible
[/Quote]
是这样的~!
wuyq11 2010-01-25
  • 打赏
  • 举报
回复
在but_Click事件中
Button btn=sender as Button;
变量保存值,设置visible
flylhf 2010-01-25
  • 打赏
  • 举报
回复
Visible属性,可以将按钮屏蔽
woaizhonguoren 2010-01-25
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 ptpa 的回复:]
看不懂  动态生成的  按钮的比较 ?
[/Quote]
就是用个循环
   int ran;
for (int i = 1; i < 10; i++)
{
for (int j = 1; j < 10; j++)
{
ran= ren.Next(0,12);
Button but = new Button();
but.Location = new Point((j * 40), i * 40);
but.Size = new Size(40, 40);
but.Tag = ren;
but.Image = imageList1.Images[ran];
but.FlatStyle = FlatStyle.Flat;
but.Click += new EventHandler(but_Click);
this.Controls.Add(but);
}
}
ptpa 2010-01-25
  • 打赏
  • 举报
回复
看不懂 动态生成的 按钮的比较 ?

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧