From 18d842675b660c69a0e4bdb7bd287054b9470bd1 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sat, 16 Apr 2016 00:10:58 +0200 Subject: [PATCH] Fix positioning of icon in CMessageBox Signed-off-by: Sven Strickroth --- src/Utils/MiscUI/MessageBox.cpp | 7 ++++--- src/Utils/MiscUI/MessageBox.h | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Utils/MiscUI/MessageBox.cpp b/src/Utils/MiscUI/MessageBox.cpp index 53edfbeb4..e6270f92b 100644 --- a/src/Utils/MiscUI/MessageBox.cpp +++ b/src/Utils/MiscUI/MessageBox.cpp @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2012-2013 - TortoiseGit +// Copyright (C) 2012-2016 - TortoiseGit // Copyright (C) 2003-2008,2010 - TortoiseSVN // This program is free software; you can redistribute it and/or @@ -688,8 +688,8 @@ void CMessageBox::OnPaint() drawrect.DeflateRect(MESSAGEBOX_BORDERMARGINX, MESSAGEBOX_BORDERMARGINY); if (m_hIcon) { - DrawIconEx(memDC.m_hDC, drawrect.left, drawrect.top + - ((drawrect.Height() - m_szAllButtons.cy - MESSAGEBOX_TEXTBUTTONMARGIN - m_szIcon.cy) / 2), + DrawIconEx(memDC.m_hDC, drawrect.left, max(drawrect.top, drawrect.top + + ((drawrect.Height() - m_szAllButtons.cy - MESSAGEBOX_TEXTBUTTONMARGIN - m_szIcon.cy) / 2)), m_hIcon, m_szIcon.cx, m_szIcon.cy, 0, nullptr, DI_NORMAL); drawrect.left += m_szIcon.cx + MESSAGEBOX_ICONMARGIN; @@ -828,6 +828,7 @@ BOOL CMessageBox::OnInitDialog() rect.bottom += szButtons.cy; rect.bottom += 2*MESSAGEBOX_BORDERMARGINY + MESSAGEBOX_TEXTBUTTONMARGIN; rect.bottom += GetSystemMetrics(SM_CYCAPTION); + rect.bottom += 2 * GetSystemMetrics(SM_CYFIXEDFRAME); rect.bottom += 2*GetSystemMetrics(SM_CYBORDER); MoveWindow(rect); diff --git a/src/Utils/MiscUI/MessageBox.h b/src/Utils/MiscUI/MessageBox.h index 73358826a..ef6378f40 100644 --- a/src/Utils/MiscUI/MessageBox.h +++ b/src/Utils/MiscUI/MessageBox.h @@ -1,5 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control +// Copyright (C) 2013-2016 - TortoiseGit // Copyright (C) 2003-2008 - TortoiseSVN // This program is free software; you can redistribute it and/or @@ -30,7 +31,7 @@ #define MESSAGEBOX_BUTTONMARGIN 5 #define MESSAGEBOX_ICONMARGIN 15 #define MESSAGEBOX_BORDERMARGINX 10 -#define MESSAGEBOX_BORDERMARGINY 5 +#define MESSAGEBOX_BORDERMARGINY 10 #define MESSAGEBOX_TEXTBUTTONMARGIN 15 #define MESSAGEBOX_BUTTONCHECKMARGIN 5 #define MESSAGEBOX_BUTTONX 20 -- 2.11.4.GIT