Archived

This topic is now archived and is closed to further replies.

23yrold3yrold

Bitmaps on buttons using Win32/Dev-C++

Recommended Posts

merlin9x9    174
Since you didn''t tell us what kind of buttons, we can''t really help you. If you''re talking about toolbar buttons (the kind managed by the system when you create a toolbar control), then the bitmaps come for free. Look it up in MSDN. If you''re trying to put a bitmap on a standard Windows push (command) button, you can use (assuming this is VC++) the resource editor to specify that the button will show a bitmap—instead of text&;and then it lets you select that bitmap from one you already have in your resource script. I know there are messages you can send to the button control to change that bitmap programmically. Again, MSDN is the place to look. If you need both a bitmap and text, then you will need either to subclass the button control or to make it owner-draw.

Share this post


Link to post
Share on other sites
23yrold3yrold    941
quote:
Since you didn''t tell us what kind of buttons, we can''t really help you. If you''re talking about toolbar buttons (the kind managed by the system when you create a toolbar control), then the bitmaps come for free.
I meant just plain buttons; toolbars hadn''t occured to me. It seems every time I see a doc on them, it says "Windows NT only"
quote:
assuming this is VC++
Dev-C++.
quote:
you can use .... the resource editor to specify that the button will show a bitmap—instead of text; and then it lets you select that bitmap from one you already have in your resource script. I know there are messages you can send to the button control to change that bitmap programmically.
I''ll look into it; thanks

Chris Barry (crbarry at mts.net)
My Personal Programming Depot

Share this post


Link to post
Share on other sites
xtrmntr    144
Also, you might want to check out the button message BM_SETIMAGE/BM_GETIMAGE. This is the blurb from MSDN about the message:

BM_SETIMAGE
An application sends a BM_SETIMAGE message to associate a new image (icon or bitmap) with the button.

To send this message, call the SendMessage function with the following parameters.

SendMessage(
(HWND) hWnd, // handle to destination window
BM_SETIMAGE, // message to send
(WPARAM) wParam, // image type
(LPARAM) lParam // handle to the image (HANDLE)
);
Parameters
wParam
Specifies the type of image to associate with the button. This parameter can be one of the following values:
IMAGE_BITMAP
IMAGE_ICON

lParam
Handle to the image to associate with the button.

Return Values
The return value is a handle to the image previously associated with the button, if any; otherwise, it is NULL.

Share this post


Link to post
Share on other sites
ELS1    127
us BS_OWNERDRAW, and set the image when you do WM_MOUSEDOWN/MOUSEUP on the control. Thats how its explained in Petzolds book.

Share this post


Link to post
Share on other sites
SimDemon    122
For CreateToolbarEx() in Dev-C++(which I use) you have to #include <commctrl.h>

and link to:

comctl32.a

If thispost = 0 Then
GoBack()

Else
Read()
End If

Share this post


Link to post
Share on other sites