Results 1 to 6 of 6

Thread: Graphics in command buttons

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Posts
    9

    Post

    Anyone know how to put a small icon in a command button on the left of the text instead of centering it?

  2. #2
    Hyperactive Member venkatraman_r's Avatar
    Join Date
    Jul 1999
    Location
    Chennai, INDIA
    Posts
    284

    Post

    Hi,

    Hope you are using the graphical style command button right? Try adding the image and the text using the code instead of from the property sheet. I have not tried it as i dont have vb in my system, still i believe there must be some option for this.

    Good Luck,
    Thanks and Regards,
    Venkat.

  3. #3
    Guest

    Post

    You could try creating a little GIF or something with the icon positioned to the left and the grey button colour to the right and then stick that onto your button.

    This would make the icon appear left aligned. You'd have to put your text in the GIF as well though as VB won't overlay a caption over a graphic.

    Mafro

  4. #4
    Lively Member benski's Avatar
    Join Date
    Sep 1999
    Location
    UK
    Posts
    126

    Post

    One way of doing it is:

    1 .Add a PictureBox with the required graphic.
    2. Add your CommandButton with the required text.
    3. Add spaces to the Caption of the CommandButton to allow for the graphic on the left hand side.
    4. Put the PictureBox in the space you've created on the CommandButton. (Bring to front if necessary (CTRL-J).

    Optional:
    5. Add code to make the PictureBox move when the mouse button is pressed - so it looks like it's on the surface of the CommandButton instead of floating on top of it:

    Eg: Picture1.Top = intPicture1YPos + intPixel
    Picture1.Left = intPicture1XPos + intPixel

    Where intPicture1XPos and intPicture1YPos are the original coordinates of the PictureBox and intPixel is Screen.TwipsPerPixelX (probably 15)

  5. #5
    Lively Member FirstKnight's Avatar
    Join Date
    Jul 1999
    Location
    Johannesburg, South Africa
    Posts
    95

    Post

    Then there's the easy way. All you have to do is open your component list (right click on toolbox, select Components) and select Microsoft Forms 2.0 Object Library. It will put a couple of controls on your toolbox, of wich one is a button. This button allows you to specify where you want the picture.

    Simple
    Today is yesterday's tomorrow

  6. #6
    Lively Member benski's Avatar
    Join Date
    Sep 1999
    Location
    UK
    Posts
    126

    Post

    Nice one!

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