[英]Need help understanding SetTextMargin for MFC CButton?
I need some guidance on understanding how SetTextMargin works for CButton.我需要一些指导来理解 SetTextMargin 如何为 CButton 工作。 What I am trying to do is have a CButton which has BS_LEFT style and using SetIcon setting an icon on the button which will appear on the left.
我想要做的是有一个 CButton,它具有 BS_LEFT 样式并使用 SetIcon 在将出现在左侧的按钮上设置一个图标。 Now the text needs to be set with some margin so that it doesn't stick too close to the icon.
现在文本需要设置一些边距,以便它不会太靠近图标。 I have some calculations on what the margin should be.
我对保证金应该是多少有一些计算。 Now the CButton::SetTextMargin takes in a CRect parameter and I need help understanding what my rect.right and rect.left should be.
现在 CButton::SetTextMargin 接受一个 CRect 参数,我需要帮助理解我的 rect.right 和 rect.left 应该是什么。 I have tried all sorts of tests but I am not able to get how the margin rectangle gets incorporated.
我已经尝试了各种测试,但我无法了解如何合并边距矩形。 My calculations of the margin and the actual margin is way off.
我对保证金和实际保证金的计算相去甚远。 Any help would be appreciated.
任何帮助将不胜感激。 Thanks!
谢谢!
Just answering this part of the question:仅回答问题的这一部分:
Now the CButton::SetTextMargin takes in a CRect parameter and I need help understanding what my rect.right and rect.left should be.
现在 CButton::SetTextMargin 接受一个 CRect 参数,我需要帮助理解我的 rect.right 和 rect.left 应该是什么。
The CRect represents how large you want the margins to be. CRect 表示您希望边距有多大。 Setting
rect.right = 0
will give you no margin on the right.设置
rect.right = 0
将使您在右侧没有边距。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.