From 6b2e953d71dd5126f8ff31701db21e76054c51c5 Mon Sep 17 00:00:00 2001 From: Carson Shook Date: Mon, 13 Dec 2021 23:21:29 -0600 Subject: [PATCH] Fixes an issue with checkbox label sizing --- Controls/Checkbox.cpp | 7 ++++++- Controls/Checkbox.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Controls/Checkbox.cpp b/Controls/Checkbox.cpp index 246b236..2910732 100644 --- a/Controls/Checkbox.cpp +++ b/Controls/Checkbox.cpp @@ -6,7 +6,7 @@ bool Controls::Checkbox::Create() int finalWidth = 0; int finalHeight = 0; - int checkboxWidth = GetCheckboxWidth(); + int checkboxWidth = GetCheckboxWidth() + (GetCheckboxBorderWidth() * 2); if (AutoSize) { @@ -63,3 +63,8 @@ int Controls::Checkbox::GetCheckboxWidth() // Will return 0 if not found return GetSystemMetrics(SM_CXMENUCHECK); } + +int Controls::Checkbox::GetCheckboxBorderWidth() +{ + return GetSystemMetrics(SM_CXEDGE); +} diff --git a/Controls/Checkbox.h b/Controls/Checkbox.h index 43b63b8..211c506 100644 --- a/Controls/Checkbox.h +++ b/Controls/Checkbox.h @@ -20,5 +20,6 @@ namespace Controls Checkbox(); Checkbox(HWND hWnd, UINT_PTR id, HINSTANCE hInstance); int GetCheckboxWidth(); + int GetCheckboxBorderWidth(); }; } \ No newline at end of file