From d30355434523f351f938b7069bd337ff0c5ba249 Mon Sep 17 00:00:00 2001 From: Curtis Wensley Date: Sun, 26 Feb 2023 11:26:07 -0800 Subject: [PATCH] Fix rip font picker --- .../Formats/Rip/Controls/FontStylePad.cs | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) 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; }