-
Sep 23rd, 2015, 02:10 PM
#1
Thread Starter
New Member
Moving the position of a JPEG in a command button
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!
-
Sep 23rd, 2015, 03:26 PM
#2
Re: Moving the position of a JPEG in a command button
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
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
-
Sep 23rd, 2015, 03:30 PM
#3
Thread Starter
New Member
Re: Moving the position of a JPEG in a command button
Originally Posted by jmsrickland
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
I would like the image to the left of the command button so that I can type text to the right. Thanks
-
Sep 23rd, 2015, 03:39 PM
#4
Re: Moving the position of a JPEG in a command button
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
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
-
Sep 23rd, 2015, 03:44 PM
#5
Thread Starter
New Member
Re: Moving the position of a JPEG in a command button
Originally Posted by jmsrickland
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
Good idea. I just assumed there would be an easier way. Thank you
-
Sep 23rd, 2015, 04:09 PM
#6
Re: Moving the position of a JPEG in a command button
Manifesting with common controls, there is an easier way
-
Sep 23rd, 2015, 04:55 PM
#7
Re: Moving the position of a JPEG in a command button
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
-
Sep 24th, 2015, 12:26 AM
#8
Re: Moving the position of a JPEG in a command button
If you add a manifest as per LaVolpe's post, you can create a button like this:
With this code:
Code:
Call SendMessage(Command1.hWnd, BM_SETIMAGE, IMAGE_ICON, ByVal hIcon)
where hIcon is an icon loaded from any number of sources, an ICO file, a res file in your EXE, or another exe/dll.
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.
Last edited by fafalone; Sep 24th, 2015 at 12:31 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|