private void addRibbonSprite(RibbonInfo rib) { PictureBox pb = new PictureBox { AutoSize = false, Size = new Size(40, 40), BackgroundImageLayout = ImageLayout.Center, Visible = false, Name = PrefixPB + rib.Name }; var img = PKMUtil.getRibbonSprite(rib.Name); if (img != null) { pb.BackgroundImage = (Bitmap)img; } if (img == null) { return; } FLP_Ribbons.Controls.Add(pb); }