简体   繁体   English

WIN32:有没有办法在文本的右侧有按钮图标(BM_SETIMAGE)

[英]WIN32: Is there a way to have the button icon (BM_SETIMAGE) on the right side of the text

Is there a way to have a button with text and graphic, with the graphic on the right side of the text, without having to owner-draw the button?有没有办法让按钮带有文本和图形,图形在文本的右侧,而不必所有者绘制按钮?

I want to just sent BM_SETIMAGE and whatever else would be needed so the graphic is to the right of the text.我只想发送BM_SETIMAGE和其他任何需要的东西,这样图形就在文本的右边。

Also, I noticed the image is so tight against the text that it doesn't look good.另外,我注意到图像与文本太紧以至于看起来不太好。 Is there a way to adjust the margin without having to use a blank space in the text?有没有办法调整边距而不必在文本中使用空格?

Is there a way to have a button with text and graphic, with the graphic on the right side of the text, without having to owner-draw the button?有没有办法让按钮带有文本和图形,图形在文本的右侧,而不必所有者绘制按钮?

There are BS_LEFTTEXT and BS_RIGHTBUTTON styles available, but the documentation says they only apply to CheckBoxes and RadioButtons:BS_LEFTTEXTBS_RIGHTBUTTON样式可用,但文档说它们仅适用于 CheckBoxes 和 RadioButtons:

Constant持续的 Description描述
BS_LEFTTEXT BS_LEFTTEXT Places text on the left side of the radio button or check box when combined with a radio button or check box style.当与单选按钮或复选框样式结合时,将文本放置在单选按钮或复选框的左侧。 Same as the BS_RIGHTBUTTON style.与 BS_RIGHTBUTTON 样式相同。
BS_RIGHTBUTTON BS_RIGHTBTON Positions a radio button's circle or a check box's square on the right side of the button rectangle.将单选按钮的圆形或复选框的正方形放置在按钮矩形的右侧。 Same as the BS_LEFTTEXT style.与 BS_LEFTTEXT 样式相同。

For a standard push button, there does not appear to be a way to control the position of the image other than through owner-drawing.对于标准按钮,除了通过所有者绘制之外,似乎没有其他方法可以控制图像的位置。

Is there a way to adjust the margin without having to use a blank space in the text?有没有办法调整边距而不必在文本中使用空格?

Use BCM_SETTEXTMARGIN / Button_SetTextMargin() :使用BCM_SETTEXTMARGIN / Button_SetTextMargin()

Sets the margins for drawing text in a button control.设置在按钮控件中绘制文本的边距。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM