How to .place a Image (BMP, JPEG etc) on a Button
-
HI How to place a Image (BMP, JPEG etc) on a Button. TO make my interface .. Good Looking. Plz tell me.. or sample code thanx
-
HI How to place a Image (BMP, JPEG etc) on a Button. TO make my interface .. Good Looking. Plz tell me.. or sample code thanx
Zeeshan Bilal wrote: How to place a Image (BMP, JPEG etc) on a Button Either create a CButton object using the BS_BITMAP style, or derive your own class from CButton and do the drawing yourself. The latter solution could for example make use of the IPicture interface to actually display the image.
We are men. We are different. We have only one word for soap. We do not own candles. We have never seen anything of any value in a craft shop. We do not own magazines full of photographs of celebrities with their clothes on. - Steve
-
Zeeshan Bilal wrote: How to place a Image (BMP, JPEG etc) on a Button Either create a CButton object using the BS_BITMAP style, or derive your own class from CButton and do the drawing yourself. The latter solution could for example make use of the IPicture interface to actually display the image.
We are men. We are different. We have only one word for soap. We do not own candles. We have never seen anything of any value in a craft shop. We do not own magazines full of photographs of celebrities with their clothes on. - Steve
-
but how can you do it in a win32 api if you have a dialog box as a resource. is there another way of doing it without having a class. with loading a bitmap and then placing it ? gabby
As you surely know you create a button using
CreateWindow
, specifying BUTTON as class name. Also here you can specify BS_BITMAP as a window style, and then use BM_SETIMAGE to place an image on the button.
We are men. We are different. We have only one word for soap. We do not own candles. We have never seen anything of any value in a craft shop. We do not own magazines full of photographs of celebrities with their clothes on. - Steve
-
HI How to place a Image (BMP, JPEG etc) on a Button. TO make my interface .. Good Looking. Plz tell me.. or sample code thanx
Have you seen this class?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
-
HI How to place a Image (BMP, JPEG etc) on a Button. TO make my interface .. Good Looking. Plz tell me.. or sample code thanx
I found that using an Icon on a button worked better than a bitmap (but the process is very similar.) I used the examples in the MSDN library (VC6 version) The SDK-level code I used is something like this:
hwndMyButton = CreateWindow("button", "", WS_CHILD | WS_VISIBLE | BS_ICON | BS_PUSHBUTTON, buttonPosX, buttonPosY, ButtonWidth, ButtonHeight, hwnd, (HMENU)ID_ButtonID, hAppInst, NULL); hButtonIcon = LoadIcon(hAppInst, MAKEINTRESOURCE(IDI_ButtonIcon)); SendMessage(hwndMyButton, BM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)(HANDLE)hButtonIcon);
I later changed to using a toolbar, because that looks more modern than Icons or Bitmaps on buttons!