我有一个复选框,我想对其进行准确测量,以便我可以在对话框上正确定位控件.我可以轻松测量控件上文本的大小 - 但我不知道计算复选框大小和文本之前(或之后)间隙的官方"方法.
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.
我很确定复选框的宽度等于
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 ...
这篇关于如何获得复选框的大小和间隙?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!