public void InitList() { int y = 0; for (int i = 0; i < 30; i++) { MTGListElement mtgListElement = new MTGListElement(); if (i % 2 == 0) { mtgListElement.setBackColour(Color.Cyan); } mtgListElement.Location = new System.Drawing.Point(1, -1 + y); mtgListElement.Name = mtgListElement.Name + 1; mtgListElement.TabIndex = i; CardEntryStruct entry = new CardEntryStruct(); entry.ClearCardEntry(); entry.id = (uint)i + 1; entry.name = "Some " + i; mtgListElement.setEntryElement((uint)i, entry); mtgListElement.clickDelegate = new MTGListElement.ReturnEnrtyDelegate(onClickFromList); listPanel.Controls.Add(mtgListElement); y += mtgListElement.Height; } }
private void AddEntryToListPanel(int index, CardEntryStruct entry) { MTGListElement mtgListElement = new MTGListElement(); int y = index * mtgListElement.Height; mtgListElement.Location = new System.Drawing.Point(1, -1 + y); mtgListElement.Name = mtgListElement.Name + "1"; mtgListElement.TabIndex = index; mtgListElement.setEntryElement((uint)index, entry); mtgListElement.clickDelegate = new MTGListElement.ReturnEnrtyDelegate(onClickFromList); listPanel.Controls.Add(mtgListElement); }