Results 1 to 8 of 8

Thread: Command Button IMAGES

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Posts
    482

    Exclamation

    Hey, many programs have command buttons that have IMAGES to the VERY left of the command button

    simple 16x16..
    these are not imageboxes ontop of the button, because the image moves with the button, and etc.

    The image stays to teh VERY LEFT of the command button and text goes to the right

    does anyone know how this is done and/or have an ocx? thanks

  2. #2
    Guest
    You can use Images for it. Just make 2 states of it; a pressed state and an unpressed state. then you can change the images on the MouseDown and MouseUp event of the main image.

  3. #3
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Smile Or...

    You can include the text as part of the image. And the standard button control has a DownPicture property and a DisabledPicture property that you can set, so you dont have to worry about mouse down and mouse up events.
    ~seaweed

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Posts
    482
    No no no!

    the text is NO IMAGE at all!

    The only image is the one on the left.. that icon NEVER moves, and the text is "focused" to the right of the button
    and will never hit the icon

    So it is its own BUTTON


    its like this

    _____________
    | % HELLO |
    -------------

    % = Icon
    and HELLO is the text
    its amazing to me that NO ONE i have ever asked, knows about this stuff.

  5. #5
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496

    ..

    I'm still trying to figure out how to make an image Pressed and upressed?? Do you do it in ms paint or something??

  6. #6
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Thumbs up

    Uhh, progeix, what i said was that the text could be part of the image, which means you create an image (your 16x16 icon) and put some text next to it in the same bitmap. Of course you also set the butons caption to nothing ("").

    If you add this bitmap to the command button, it will look like your "drawing". If you want the text to appear centered on the button with the icon to the left of it, draw the icon, put the text to the right of it, and then leave some space (the width of your icon) to the right of the text.

    You also need to make a background color for your bitmap one that you aren't using in your icon or text. Then set this color to the CommandButton's MaskColor property and set the CommandButton's UseMask property to true. This will give you a transparent background to your image, so all you see is the icon and text.

    By the way, in your first post you said:
    these are not imageboxes ontop of the button, because the image moves with the button
    In your next post you said:
    The only image is the one on the left.. that icon NEVER moves
    You seem to be contradicting yourself.

    Lethal, you can create images in MSPaint. If you want the image to change when the button is pressed, open the "non-pressed" image, make whatever changes you want to it, then save it under a different name. Then assign the first image to the CommandButton's Picture property, and the second (pressed) image to the CommandButton's DownPicture property. Likewise, if you want a different picture when the button is diabled (usually the same picture only "greyed out") then create another MSPaint file and assign it to the CommandButton's DisabledPicture property.

    ~seaweed

  7. #7
    Hyperactive Member Asaf_99's Avatar
    Join Date
    Jul 2000
    Location
    Israel
    Posts
    335

    Red face

    Hey, is it just me or progeix just had a bad day?
    Asaf Sagi

    ICQ: 61917199
    E-Mail: [email protected]

  8. #8
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Cool sounds like a bad day to me

    progeix, I'm sending you a quick example of how to do a graphic and text in an image on a command button.

    One noticeable limitation of my implementation, however, is that you have no control over the text color for the button caption. If you user is using a system color other than the one set in your graphic, your buttons that use system colors will appear different than the ones that use graphics. (You may notice that in the example I sent you since my button caption system color is not black).

    Hope that helps clear things up a little

    [Edited by seaweed on 11-03-2000 at 05:23 PM]
    ~seaweed

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