如何获得复选框的大小和间隙?

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.

推荐答案

我很确定复选框的宽度等于

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

这篇关于如何获得复选框的大小和间隙?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:如何获得复选框的大小和间隙?

基础教程推荐