private void setBG(Panel panel) { var texInfo = GetTexInfoFor(panel); Bitmap bgi = null; if (texInfo.tex0 == null) { Bitmap b = new Bitmap(1, 1); b.SetPixel(0, 0, Color.Brown); bgi = b; } else { Bitmap image = new Bitmap(texInfo.tex0.GetImage(0)); if (panel == seriesicon && selmapMarkPreview) { bgi = BitmapUtilities.Invert(BitmapUtilities.AlphaSwap(image)); } else if (panel == prevbase && selmapMarkPreview && scribble != null) { bgi = BitmapUtilities.ApplyMask(image, scribble); } else { bgi = image; } if (bgi.Size != panel.Size) { bgi = BitmapUtilities.Resize(bgi, panel.Size); } } if (!texInfo.ForThisFrameIndex) { bgi = BitmapUtilities.Border(bgi, Color.Brown, 2); } panel.BackgroundImage = bgi; }