Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.

Commit 1e1b540

Browse files
drolevarrobmen
authored andcommitted
Use default colors in VS2022.
Current implementation of the plugin GUI uses the legacy approach for property page implementation, which doesn't allow for proper theming support. Existing property pages for .NET 4.8 projects and below exhibit the same behaviour.
1 parent c680f3c commit 1e1b540

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/votive.shared/PropertyPages/WixPropertyPagePanel.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,7 @@ public WixPropertyPagePanel(WixPropertyPage parentPropertyPage)
4343
this.InitializeComponent();
4444

4545
this.Font = WixHelperMethods.GetDialogFont();
46-
#if Dev17
47-
// VS2022 doesn't use theming on property pages
48-
this.BackColor = SystemColors.Control;
49-
#else
5046
this.BackColor = WixHelperMethods.GetVsColor(WixHelperMethods.Vs2010Color.VSCOLOR_BUTTONFACE);
51-
#endif
5247
this.ForeColor = WixHelperMethods.GetVsColor(WixHelperMethods.Vs2010Color.VSCOLOR_BUTTONTEXT);
5348
}
5449

src/votive.shared/WixHelperMethods.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -678,8 +678,7 @@ internal static void SetControlTreeColors(Control parent)
678678
internal static void SetSingleControlColors(Control control)
679679
{
680680
control.ForeColor = GetVsColor(Vs2010Color.VSCOLOR_BUTTONTEXT);
681-
if (control is TextBox || control is ListBox || control is ListView || control is ComboBox ||
682-
control is WixBuildEventTextBox)
681+
if (control is TextBox || control is ListBox || control is ListView || control is ComboBox)
683682
{
684683
control.BackColor = GetVsColor(Vs2010Color.VSCOLOR_WINDOW);
685684
}
@@ -692,20 +691,22 @@ internal static void SetSingleControlColors(Control control)
692691
/// <returns>The color itself</returns>
693692
internal static Color GetVsColor(Vs2010Color visualStudioColor)
694693
{
694+
#if !Dev17 // VS2022 doesn't support theming for legacy property pages
695695
uint win32Color = 0;
696696
IVsUIShell2 vsuiShell2 = WixPackage.GetGlobalService(typeof(SVsUIShell)) as IVsUIShell2;
697697
if (vsuiShell2 != null && vsuiShell2.GetVSSysColorEx((Int32)visualStudioColor, out win32Color) == VSConstants.S_OK)
698698
{
699699
Color color = ColorTranslator.FromWin32((int)win32Color);
700700
return color;
701701
}
702+
#endif
702703

703704
// We need to fall back to some reasonable colors when we're not running in VS
704705
// to keep the forms/property pages editable in the designers
705706
switch (visualStudioColor)
706707
{
707708
case Vs2010Color.VSCOLOR_BUTTONFACE:
708-
return SystemColors.ButtonFace;
709+
return SystemColors.Control;
709710

710711
case Vs2010Color.VSCOLOR_BUTTONTEXT:
711712
return SystemColors.ControlText;

0 commit comments

Comments
 (0)