[Win32]Set bitmap to button
-
Hi, I want to add a bitmap to a button in my DialogBox. The code is:
case WM_INITDIALOG:
hBmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_QUIT));
SendMessage(GetDlgItem(hDlg,ID_QUIT),BM_SETIMAGE,(WPARAM)IMAGE_BITMAP,(LPARAM)hBmp);return (INT_PTR)TRUE;
but why don't work?
-
Hi, I want to add a bitmap to a button in my DialogBox. The code is:
case WM_INITDIALOG:
hBmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_QUIT));
SendMessage(GetDlgItem(hDlg,ID_QUIT),BM_SETIMAGE,(WPARAM)IMAGE_BITMAP,(LPARAM)hBmp);return (INT_PTR)TRUE;
but why don't work?
if it was that easy, CP wouldn't need four dozen articles on bitmap buttons[^]
-
if it was that easy, CP wouldn't need four dozen articles on bitmap buttons[^]
but is it possible to add an image with BM_SETIMAGE without ownerdraw button?
-
Hi, I want to add a bitmap to a button in my DialogBox. The code is:
case WM_INITDIALOG:
hBmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_QUIT));
SendMessage(GetDlgItem(hDlg,ID_QUIT),BM_SETIMAGE,(WPARAM)IMAGE_BITMAP,(LPARAM)hBmp);return (INT_PTR)TRUE;
but why don't work?
What is the return value of LoadBitmap function?
-
but is it possible to add an image with BM_SETIMAGE without ownerdraw button?
are you setting the BS_BITMAP style when you create the button?
-
What is the return value of LoadBitmap function?
not NULL
-
are you setting the BS_BITMAP style when you create the button?
no because with BS_BITMAP style show bitmap only without text in the button. I need [Bitmap+Text]
-
no because with BS_BITMAP style show bitmap only without text in the button. I need [Bitmap+Text]
-
I know but don't work in that way!
-
I know but don't work in that way!
Member 2965471 wrote:
I know but don't work in that way!
I have just tested this and it works OK. You need to ensure that your bitmap is the same size or smaller than your button. Also if you need to show both bitmap and text, then you must ensure that your bitmap is small enough to leave space for the text.
The best things in life are not things.
modified on Thursday, June 16, 2011 9:35 AM