Results 1 to 8 of 8

Thread: Moving the position of a JPEG in a command button

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2015
    Posts
    6

    Talking 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!

  2. #2
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    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.

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2015
    Posts
    6

    Re: Moving the position of a JPEG in a command button

    Quote Originally Posted by jmsrickland View Post
    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

  4. #4
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    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.

  5. #5

    Thread Starter
    New Member
    Join Date
    Sep 2015
    Posts
    6

    Re: Moving the position of a JPEG in a command button

    Quote Originally Posted by jmsrickland View Post
    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

  6. #6
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Moving the position of a JPEG in a command button

    Manifesting with common controls, there is an easier way
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  7. #7
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,543

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,719

    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
  •  



Click Here to Expand Forum to Full Width