WIN32: Is there a way to have the button icon (BM_SETIMAGE) on the right side of the text - winapi

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.
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:
Constant
Description
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
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.
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():
Sets the margins for drawing text in a button control.

Related

Enlarged display of Visual-Studio window

Visual-Studio is displaying enlarged character so that it is impossible to use it. How to zoom down the application so that it displays all commands in the window in a readable and usable manner?
Bottom left of each editor is a zoom control:
Clicking on that will allow typing in a new percentage, so selection from the drop down.

How to make sure groupbox always fit in the screen?

I am trying to create app. In the form, there is only 3 button in a groupbox. I want to make the groupbox always fit in the screen. The problem is when i minimize the form, there is vertical and horizontal scroll. So i cannot see the whole groupbox border:
I want to make the groupbox to minimize without the scroll and i am able to see all the border just like when in the maximize screen as below:
I have already tried groupbox autosize to true while anchor to top, bottom, right, and left but it is still not working. Any idea how i can achieve this?
As #ib11 said you need to go to Dock and select Fill. In addition, if you want to make your group box not fill the form but grow with it, you'll probably need to change the Anchor to all sides. That's why your previous settings didn't work because anchor doesn't fill the screen, it's just a property to grow with the screen. Fill makes it possible so that you can have a group box or any other control always fill the screen.
See this image for dock:
See this image for anchor:
You need to set the Dock property of the GroupBox to Fill.
Like so:

Extending clickable area of a standard Win32 button?

I have a button which, due to margins (and it looks better this way) is 3 pixels from the edge of the screen. I'd like it to highlight on mouse-over in this margin region, so that it can be clicked by moving the mouse to the side of the screen.
Is there any way to extend the clickable area of a standard Win32 button, such that the button believes its clickable area to be larger than its drawing area?

Change Label Text Alignment in App Inventor 2 code block

I would like to know wether we can change the Text Alignment of a label using the App Inventor 2's Code Block. I would like to make a button to select the text alignment position of a label or button.
You can't change the text alignment of a label programmatically in App Inventor
As workaround for example define 2 Labels, one having an alignment left and another having an alighment right and hide the second label. Then after button click copy the text of the label and display the other label instead, see screenshot.

XCode: Graphical button with invisible title

I have a bunch of buttons. They appears as an graphical image. If a user clicked on a button I can determine with
sender.titleLabel!.text!
which button the user pressed. But the title of the button appears in the view. I want only to show the image and give the button a invisible title. But I think that is not possible.
Me second solution is to create for each button an outlet. But I think with 30 buttons that is a very bad solution.
Option 1:
For the button text color property set opacity to 0. The text is there, but fully transparent.
Option 2:
You may use the tag value to identify a button so you do not have to rely on the button title. You can set the tag value in interface builder (Xcode) or in code. (The tag is an integer.)
I usually prefer option 2 as it is resilient to text changes over time (think of typos, translations for other languages etc.).

Resources