public void SetPlayer(PlayerEntry plr) { if (InvokeRequired) { Invoke(new Action<PlayerEntry>(SetPlayer), plr); return; } Player = plr; SetTitle(plr); RemoveAll(p => (p.Tag as string) == "Note"); if (!string.IsNullOrWhiteSpace(plr.Note)) { SuspendLayout(); var tab = new TabPage("Note") { Tag = "Note", BackColor = this.BackColor }; var lbl = new Label { Font = new Font(Font.FontFamily, Font.SizeInPoints, FontStyle.Bold), Text = plr.Note }; tab.Controls.Add(lbl); AddTab(tab); ResumeLayout(); } Invalidate(); //Forces the color change }
void SetTitle(PlayerEntry ply) { SetName(ply.Name); NameLabel.Links.Add(0, ply.Name.Length, Tuple.Create(ply.Id, ply.Name)); }