请帮忙看一下

lkskldkldsds 2011-08-05 09:37:41
public void DisPlayButton()
{
SimpleButton BT = new SimpleButton();
BT.Text = "aa";
BT.Location = new Point(30, 27);
BT.Size = new Size(110, 60);
forms.Controls.Add(BT);
BT.Click += new EventHandler(ShowForm);
}

private void ShowForm(object sender, EventArgs e)
{
MessageBox.Show("你点击的是" + + "控件");
}

我想MessageBox.Show我点击Button 的Text
...全文
57 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
杨友山 2011-08-05
  • 打赏
  • 举报
回复
private void ShowForm(object sender, EventArgs e)
{
SimpleButton button = (SimpleButton)sender;
string ss = button.Text;
MessageBox.Show("你点击的是" +ss + "控件");
}

ohkuy 2011-08-05
  • 打赏
  • 举报
回复

private void ShowForm(object sender, EventArgs e)
{
string message=((Button)sender).Text;
MessageBox.Show("你点击的是" + message+ "控件");
}


熙风 2011-08-05
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 ohkuy 的回复:]
C# code

private void ShowForm(object sender, EventArgs e)
{
string message=((Button)sender).Text;
MessageBox.Show("你点击的是" + message+ "控件");
}
[/Quote]

+1

110,532

社区成员

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

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

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