[GcodePreview]Fix background on dark theme (#29837)

This commit is contained in:
Pedro Lamas
2023-11-14 15:34:04 +00:00
committed by GitHub
parent 89a87e6db4
commit 9d2f9bcff2
4 changed files with 54 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
#include "pch.h"
#include "GcodePreviewHandler.h"
#include "../powerpreview/powerpreviewConstants.h"
#include <shellapi.h>
#include <Shlwapi.h>
@@ -9,6 +10,7 @@
#include <common/logger/logger.h>
#include <common/SettingsAPI/settings_helpers.h>
#include <common/utils/process_path.h>
#include <common/Themes/windows_colors.h>
extern HINSTANCE g_hInst;
extern long g_cDllRef;
@@ -202,6 +204,8 @@ IFACEMETHODIMP GcodePreviewHandler::Unload()
IFACEMETHODIMP GcodePreviewHandler::SetBackgroundColor(COLORREF color)
{
HBRUSH brush = CreateSolidBrush(WindowsColors::is_dark_mode() ? powerpreviewConstants::DARK_THEME_COLOR : powerpreviewConstants::LIGHT_THEME_COLOR);
SetClassLongPtr(m_hwndParent, GCLP_HBRBACKGROUND, reinterpret_cast<LONG_PTR>(brush));
return S_OK;
}

View File

@@ -102,6 +102,9 @@
<ProjectReference Include="..\..\..\common\SettingsAPI\SettingsAPI.vcxproj">
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\common\Themes\Themes.vcxproj">
<Project>{98537082-0fdb-40de-abd8-0dc5a4269bab}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="..\..\..\..\deps\spdlog.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />