Hello,
I have added an image to a command button however I am unable to manipulate the position. The image is always positioned in the centre of the command button.
If anyone does not understand my question please contact me.
Thanks in advance!
Printable View
Hello,
I have added an image to a command button however I am unable to manipulate the position. The image is always positioned in the centre of the command button.
If anyone does not understand my question please contact me.
Thanks in advance!
I would think the center is the correct position for the image. Where do you want it positioned.
Make sure the image is the correct size and that you do not have any text in the .Caption property
So you want a command button with an image on the left and have the button caption on the right? First the .caption is always centered on the button so right here you can't have it on the right anymore than you can have the image on the left. Why don't you make the image both the picture and the text and let it be centered on the button
Manifesting with common controls, there is an easier way
Out of the box, there isn't a straightforward way (disclaimer: I haven't read the link posted by lavolpe)... I do know some third party controls do have that capability though...
-tg
If you add a manifest as per LaVolpe's post, you can create a button like this:
http://i.imgur.com/WzJ0Rx2.jpg
With this code:
where hIcon is an icon loaded from any number of sources, an ICO file, a res file in your EXE, or another exe/dll.Code:Call SendMessage(Command1.hWnd, BM_SETIMAGE, IMAGE_ICON, ByVal hIcon)
Here's a project I made showing how to do it from a resource file, with some good comments in the thread to read too.