如何用c#写动态添加按钮的鼠标事件
解决方案 »
- windows media player 二次开发,播放AVI有声无图像?
- 怎么让Form2始终处于Form1之前,即使Form1的topmost被设置为true
- C# 键盘事件(如果不让任务管理器跳出来)
- 读取vc生成的结构体文件,在线等
- 用jmail发送邮件问题,错误:The message was undeliverable. All servers failed to receive the message
- 请问使用 C# 执行 dos命令能补抓错误讯息吗?
- 请高手帮忙!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 小问题,关于邮件发送的!
- C#调用C++DLL返回值是个抽象类指针,如何调用其中的函数(不对外发布)?
- 读取excel文件解决空行的问题
- 关于asp.net(c#)计时器的问题。。。请指教!!
- 请问怎么随着鼠标的滚动在窗体中滚动图片(急,谢绝灌水)?
{
for(int i = 1; i < 3; i++)
{
m_panel.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(64)), ((System.Byte)(64)));
m_panel.Location = new System.Drawing.Point(200, 64 + (i-1)*100);
m_panel.Name = "panel" + i.ToString();
m_panel.Size = new System.Drawing.Size(200, 200);
m_panel.TabIndex = i;
this.Controls.Add(m_panel); InitializeSeat(m_seatNum);
}
}
private void InitializeSeat(int seatNum)
{
for(int i = 1; i < seatNum + 1; i++)
{
Button button = new Button();
button.Location = new System.Drawing.Point(16, 16 + i*48);
button.Name = "button" + i.ToString();
button.TabIndex = 35;
button.Text = "";
this.Controls.Add(button); button.MouseDown += new System.Windows.Forms.MouseEventHandler(this.button_MouseDown); m_panel.Controls.Add(button); }
}
private void button_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button == MouseButtons.Right)
MessageBox.Show("ssaa");
}在此事件中我要针对点的哪个button做出相关操作