Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get size of check and gap in check box?

I have a check box that I want to accurately measure so I can position controls on a dialog correctly. I can easily measure the size of the text on the control - but I don't know the "official" way of calculating the size of the check box and the gap before (or after) the text.

like image 495
Mark Ingram Avatar asked Jul 22 '09 12:07

Mark Ingram


People also ask

How do I change the size of a checkbox?

Method 1: The checkbox size can be set by using height and width property. The height property sets the height of checkbox and width property sets the width of the checkbox.

How do I resize a checkbox in Excel?

1. Right-click the checkbox, and select Format Control from the right-clicking menu as below screenshot show. 2. In the popping up Format Control dialog box, select the Move and size with cells option under the Properties tab, and then click the OK button.


1 Answers

I'm pretty sure the width of the checkbox is equal to

int x = GetSystemMetrics( SM_CXMENUCHECK );
int y = GetSystemMetrics( SM_CYMENUCHECK );

You can then work out the area inside by subtracting the following ...

   int xInner = GetSystemMetrics( SM_CXEDGE );
   int yInner = GetSystemMetrics( SM_CYEDGE );

I use that in my code and haven't had a problem thus far ...

like image 146
Goz Avatar answered Oct 15 '22 00:10

Goz