| 195 | } |
| 196 | |
| 197 | bool BaseXamlPageHost::PaintBackground(HDC dc, const RECT &target, winrt::Windows::UI::Color col) |
| 198 | { |
| 199 | if (!m_BackgroundBrush || m_BackgroundColor != col) [[unlikely]] |
| 200 | { |
| 201 | m_BackgroundBrush.reset(CreateSolidBrush(RGB(col.R, col.G, col.B))); |
| 202 | if (m_BackgroundBrush) |
| 203 | { |
| 204 | m_BackgroundColor = col; |
| 205 | } |
| 206 | else |
| 207 | { |
| 208 | MessagePrint(spdlog::level::info, L"Failed to create background brush"); |
| 209 | return false; |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | if (FillRect(dc, &target, m_BackgroundBrush.get())) |
| 214 | { |
| 215 | return true; |
| 216 | } |
| 217 | else |
| 218 | { |
| 219 | LastErrorHandle(spdlog::level::info, L"Failed to fill rectangle."); |
| 220 | return false; |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | BaseXamlPageHost::BaseXamlPageHost(WindowClass &classRef, WindowClass &dragRegionClass) : |
| 225 | MessageWindow(classRef, { }), |