.bmp buttons - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

.bmp buttons

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.

[code]
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);[/code]

orcblood

Comments

  • AsmGuru62AsmGuru62 Posts: 6,519Member
    : 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.
    :
    : [code]
    : 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);[/code]
    :
    : orcblood
    :
    [blue]In addition to [b]BS_PUSHBUTTON[/b] use [b]BS_BITMAP[/b] style. Apply the image with [b]BM_SETIMAGE[/b] message to newly created [b]HWND[/b] of your button.[/blue]
  • OrcbloodOrcblood Posts: 44Member
    [b][red]This message was edited by Orcblood at 2003-1-21 13:16:24[/red][/b][hr]
    : : 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.
    : :
    : : [code]
    : : 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);[/code]
    : :
    : : orcblood
    : :
    : [blue]In addition to [b]BS_PUSHBUTTON[/b] use [b]BS_BITMAP[/b] style. Apply the image with [b]BM_SETIMAGE[/b] message to newly created [b]HWND[/b] of your button.[/blue]
    :

    Would the BM_SETIMAGE go where I've declaired the buttons the [code]HWND hButtonNewGame, hButtonLoadGame, hButtonOptions[/code]? How would I code this too - I've never dealed with Bitmaps in windows coding too much before....

    orcblood
  • AsmGuru62AsmGuru62 Posts: 6,519Member
    : [b][red]This message was edited by Orcblood at 2003-1-21 13:16:24[/red][/b][hr]
    : : : 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.
    : : :
    : : : [code]
    : : : 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);[/code]
    : : :
    : : : orcblood
    : : :
    : : [blue]In addition to [b]BS_PUSHBUTTON[/b] use [b]BS_BITMAP[/b] style. Apply the image with [b]BM_SETIMAGE[/b] message to newly created [b]HWND[/b] of your button.[/blue]
    : :
    :
    : Would the BM_SETIMAGE go where I've declaired the buttons the [code]HWND hButtonNewGame, hButtonLoadGame, hButtonOptions[/code]? How would I code this too - I've never dealed with Bitmaps in windows coding too much before....
    :
    : orcblood
    :
    [code]
    HWND hBtn = CreateWindow (...);
    HBITMAP hBmp = LoadBitmap (hInstance, MAKEINTRESOURCE (IDB_YOURIMAGE));

    SendMessage (hBtn, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hBmp);
    [/code]
Sign In or Register to comment.