From 05d434f6b22560a768b3ef7d8d717232a094c66d Mon Sep 17 00:00:00 2001 From: "Alan v. Drake" Date: Tue, 31 Oct 2023 16:37:22 +0100 Subject: [PATCH] Editor: bugfixes for themed ComboBoxCustom Not sure how I missed it, but we have to manually draw the text when using UserPaint so it's painted correctly in all cases. Also added WM_WINDOWPOSCHANGED to catch the case where the control is being resized. Fixes #1924 --- Editor/AGS.Editor/ColorThemes/Controls/ComboBoxCustom.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Editor/AGS.Editor/ColorThemes/Controls/ComboBoxCustom.cs b/Editor/AGS.Editor/ColorThemes/Controls/ComboBoxCustom.cs index ab7fbdec4fb..4eadddeb1f9 100644 --- a/Editor/AGS.Editor/ColorThemes/Controls/ComboBoxCustom.cs +++ b/Editor/AGS.Editor/ColorThemes/Controls/ComboBoxCustom.cs @@ -8,6 +8,7 @@ namespace AGS.Editor public class ComboBoxCustom : ComboBox { private const int WM_PAINT = 0x000F; + private const int WM_WINDOWPOSCHANGED = 0x0047; private readonly ColorTheme _theme; private readonly string _root; @@ -101,6 +102,7 @@ protected override void WndProc(ref Message m) switch (m.Msg) { case WM_PAINT: + case WM_WINDOWPOSCHANGED: Graphics graphics = Graphics.FromHwnd(Handle); Rectangle rectBorder = new Rectangle(0, 0, Width, Height); Rectangle rectButton = new Rectangle(Width - 19, 0, 19, Height); @@ -133,6 +135,13 @@ protected override void WndProc(ref Message m) //Draw button arrow graphics.FillPath(arrow, path); + + // Draw text + Rectangle rectText = new Rectangle(3, 3, Width-19, Height- 3); + if (Text != null) + graphics.DrawString(Text, Font, + new SolidBrush(_theme.GetColor(_root + "/item-selected/foreground")), rectText); + break; } }