我有一個基於我的數據庫創建控制面板的類。它創建一個面板,每個面板上都有一個按鈕,每個DB都有一個按鈕。我如何解決一個特定的按鈕來進行點擊事件?爲clickevent生成一個生成的按鈕
我是一個新手,也許在我的頭上升技,但你不學會在淺水中游泳;) 任何幫助表示讚賞!
while (myDataReader.Read())
{
i++;
Oppdrag p1 = new Oppdrag();
p1.Location = new Point (0, (i++) * 65);
oppdragPanel.Controls.Add(p1);
p1.makePanel();
}
class Oppdrag : Panel
{
Button infoBtn = new Button();
public void makePanel()
{
this.BackColor = Color.White;
this.Height = 60;
this.Dock = DockStyle.Top;
this.Location = new Point(0, (iTeller) * 45);
infoBtn.Location = new Point(860, 27);
infoBtn.Name = "infoBtn";
infoBtn.Size = new Size(139, 23);
infoBtn.TabIndex = 18;
infoBtn.Text = "Edit";
infoBtn.UseVisualStyleBackColor = true;
}
}
甜! Thx,正是我需要的! – MrHaga