diff --git a/Source/Pablo/Formats/Rip/Controls/FontStylePad.cs b/Source/Pablo/Formats/Rip/Controls/FontStylePad.cs index ef38040..6328b59 100644 --- a/Source/Pablo/Formats/Rip/Controls/FontStylePad.cs +++ b/Source/Pablo/Formats/Rip/Controls/FontStylePad.cs @@ -72,24 +72,21 @@ Control FontType() Size = new Size(40, 40) }; - drawable.MouseUp += delegate - { - SelectFont(); - }; - - drawable.Paint += delegate(object sender, PaintEventArgs pe) - { - if (canvas != null) - canvas.DrawRegion(pe.Graphics, new Rectangle(Point.Empty, canvas.WindowSize)); - }; + drawable.MouseUp += (sender, e) => SelectFont(); - drawable.LoadComplete += delegate // Shown? + drawable.Paint += (sender, e) => { if (drawable.Size.IsEmpty) return; - canvas = new BGICanvas(drawable, drawable.Size); - DrawCanvas(); + if (canvas == null || canvas.WindowSize != drawable.Size) + { + canvas = new BGICanvas(drawable, drawable.Size); + DrawCanvas(); + } + + canvas?.DrawRegion(e.Graphics, new Rectangle(Point.Empty, canvas.WindowSize)); }; + return drawable; }