From a4bd23e5892a183df5d2250ad5d95afbf625878e Mon Sep 17 00:00:00 2001 From: SimplestStudio Date: Fri, 27 Dec 2024 12:15:23 +0200 Subject: [PATCH] [win] online-installer: refactoring DrawBorder --- .../src/uiclasses/drawningengine.cpp | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/win-linux/extras/online-installer/src/uiclasses/drawningengine.cpp b/win-linux/extras/online-installer/src/uiclasses/drawningengine.cpp index b75285690..c0613c243 100644 --- a/win-linux/extras/online-installer/src/uiclasses/drawningengine.cpp +++ b/win-linux/extras/online-installer/src/uiclasses/drawningengine.cpp @@ -118,15 +118,19 @@ void DrawingEngine::FillBackground() const void DrawingEngine::DrawBorder() const { - HPEN hPen = CreatePen(PS_SOLID, m_ds->metrics()->value(Metrics::BorderWidth), m_ds->palette()->color(Palette::Border)); - HPEN oldPen = (HPEN)SelectObject(m_hdc, hPen); - MoveToEx(m_hdc, m_rc->left, m_rc->top, NULL); - LineTo(m_hdc, m_rc->right - 1, m_rc->top); - LineTo(m_hdc, m_rc->right - 1, m_rc->bottom - 1); - LineTo(m_hdc, m_rc->left, m_rc->bottom - 1); - LineTo(m_hdc, m_rc->left, m_rc->top); - SelectObject(m_hdc, oldPen); - DeleteObject(hPen); + RECT rc; + SetRect(&rc, m_rc->left, m_rc->top, m_rc->right, m_rc->bottom); + HBRUSH brdBrush = CreateSolidBrush(m_ds->palette()->color(Palette::Border)); + HBRUSH oldBrdBrush = (HBRUSH)SelectObject(m_hdc, brdBrush); + for (int i = 0; i < m_ds->metrics()->value(Metrics::BorderWidth); i++) { + FrameRect(m_hdc, &rc, brdBrush); + rc.left += i + 1; + rc.top += i + 1; + rc.right -= i + 1; + rc.bottom -= i + 1; + } + SelectObject(m_hdc, oldBrdBrush); + DeleteObject(brdBrush); } void DrawingEngine::DrawTopBorder(int brdWidth, COLORREF brdColor) const