Results 1 to 5 of 5

Thread: Putting a picture on a button

  1. #1
    Guest

    Post

    Im using visual C++, how do i put a bitmap on a button?

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Code:
    HBITMAP hBit = (HBITMAP)LoadImage(NULL,"C:\\.....",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
    butt1.SetBitmap (hBit);
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3
    Guest
    Whats with the butt1.SetBitmap thing, I dont think you can use Visual Basic code inside C++ code.

  4. #4
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    That is the variable for the Button. By the way this code is only for MFC.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Use Vlatko's loading code, but this to set it:
    Code:
    SendMessage(hWnd_Button, BM_SETIMAGE, IMAGE_BITMAP, hBit);
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

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