CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2000
    Posts
    28

    setting state of a button

    How can I set the state of a button so that it looks as if it is pushed?

    thanx,

    ds


  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: setting state of a button


    'you do this with toolbar buttons (not with commandbutton). Add a toolbar to
    'your form (=microsoft windows common controls) and this code:
    With Toolbar1
    .Buttons.Add , "AA", "AA"
    .Buttons("AA").Value = tbrPressed
    End With
    'you may assign pictures (icons) to these buttons just adding a imagelist
    'control, adding images to it and assigning the imagelist to the listimage
    'property of toolbar, then assigning a image to each button by index or by
    'key




    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris
    and all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

    The Rater
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    Jun 2001
    Location
    Israel
    Posts
    228

    Re: setting state of a button

    You can't, but you can achieve the same results using a CheckBox.
    add a new CheckBox, set style to 1-Graphical and walla! you have a command button. set its value to 1 or 0 to make it pushed or unpushed.

    ----------
    The @host is everywhere!
    ----------

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

Featured