CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Posts
    23

    image in API button?

    Can somebody tell me how to attach a bitmap to a button using Windows API only? Thanks in advance!

    Thomas


  2. #2
    Guest

    Re: image in API button?

    Hello,

    If you use MFC it's very easy

    1 ) for eatch button create 3 bitmap resource

    call

    Button_D => Img button Down
    Button_F => Img button Focus
    Button_U => Img button Up

    2 ) create your button ( don't use classwizard )
    - Create the button in your Dlg and call it IDC_PUSH_BUTTON ( for example ), in the area where you put text, put Button_ don't forgat to put the _, and Activate the flag Ownerdraw.
    - CBitmapButton c_My_Button; ( in header file .h )
    - On the OnInitDialog or the Init fonction of your SDI or MDI ( .cpp ):
    c_My_Button; = new CBitmapButton;
    VERIFY ( c_My_Button; -> AutoLoad ("Put here the name of the button resource ex : IDC_PUSH_BUTTON ), this ));

    A+,

    Arnaud Chainard at :
    [email protected]


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