:
This message was edited by Orcblood at 2003-1-21 13:16:24
: : : I was wondering how to create a bitmap button... I know it might be a hard task but I want to use custom .bmp images for a little game project that Im working on... I have the following code, but I don't know how to use a bitmap file for a button... Anyways, if some one could tell me how to create the bitmap button or just re-write my code then I would love the help!
: : :
: : : Ps, I have the .bmp in my resource files - I can recreate it so that its 16 million colours if nessessary.
: : :
: : :
: : : hButtonNewGame =
: : : CreateWindow("BUTTON", "New Game",
: : : WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 150, 130, 80, 20,
: : : hwnd,(HMENU) 1, hInstGlobal, NULL);
: : : hButtonLoadGame =
: : : CreateWindow("BUTTON", "Load Game",
: : : WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 150, 160, 80, 20,
: : : hwnd,(HMENU) 2, hInstGlobal, NULL);
: : : hButtonOptions =
: : : CreateWindow("BUTTON", "Options",
: : : WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 150, 190, 80, 20,
: : : hwnd,(HMENU) 1, hInstGlobal, NULL);
: : :
: : : orcblood
: : :
: :
In addition to BS_PUSHBUTTON use BS_BITMAP style. Apply the image with BM_SETIMAGE message to newly created HWND of your button.
: :
:
: Would the BM_SETIMAGE go where I've declaired the buttons the
HWND hButtonNewGame, hButtonLoadGame, hButtonOptions
? How would I code this too - I've never dealed with Bitmaps in windows coding too much before....
:
: orcblood
:
HWND hBtn = CreateWindow (...);
HBITMAP hBmp = LoadBitmap (hInstance, MAKEINTRESOURCE (IDB_YOURIMAGE));
SendMessage (hBtn, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hBmp);