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

前端 未结 7 1439
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-15 06:46

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\'

7条回答
  •  隐瞒了意图╮
    2020-12-15 07:09

    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 ...

提交回复
热议问题