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 ...
这篇关于如何获得复选框的大小和间隙?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何获得复选框的大小和间隙?


- STL 中有 dereference_iterator 吗? 2022-01-01
- C++ 协变模板 2021-01-01
- 一起使用 MPI 和 OpenCV 时出现分段错误 2022-01-01
- 与 int by int 相比,为什么执行 float by float 矩阵乘法更快? 2021-01-01
- 如何对自定义类的向量使用std::find()? 2022-11-07
- 从python回调到c++的选项 2022-11-16
- Stroustrup 的 Simple_window.h 2022-01-01
- 使用/clr 时出现 LNK2022 错误 2022-01-01
- 静态初始化顺序失败 2022-01-01
- 近似搜索的工作原理 2021-01-01