Pohoda
December 2nd, 2006, 03:01 PM
Hi, I'm trying to put bitmap on button with bitblt function (and I can't use BM_SETIMAGE etc.).
global variables:
HINSTANCE hInst;
HWND hWnd;
HWND bt_up;
HBITMAP hBitmapHome;
WM_CREATE:
bt_up = CreateWindow(TEXT("button"), TEXT("HOME"),
WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
10, 10, 100, 100,
hWnd, (HMENU) 1001, hInst, NULL);
WM_PAINT:
...
hdc2 = GetDC(bt_up);
hBitmapHome = LoadBitmap(hInst, TEXT("HOME"));
if (hBitmapHome == NULL)
MessageBox(hWnd, TEXT("bitmap"), TEXT("err"), MB_OK);
hdcMem = CreateCompatibleDC(hdc2);
SelectObject(hdcMem, hBitmapHome);
BitBlt(hdc2, 90, 90, 40, 40, hdcMem, 0,0,SRCCOPY);
DeleteObject(hdcMem);
...
Problem is, that bitmap is under the button, not on it. Anyone has idea where I'm wrong?
global variables:
HINSTANCE hInst;
HWND hWnd;
HWND bt_up;
HBITMAP hBitmapHome;
WM_CREATE:
bt_up = CreateWindow(TEXT("button"), TEXT("HOME"),
WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
10, 10, 100, 100,
hWnd, (HMENU) 1001, hInst, NULL);
WM_PAINT:
...
hdc2 = GetDC(bt_up);
hBitmapHome = LoadBitmap(hInst, TEXT("HOME"));
if (hBitmapHome == NULL)
MessageBox(hWnd, TEXT("bitmap"), TEXT("err"), MB_OK);
hdcMem = CreateCompatibleDC(hdc2);
SelectObject(hdcMem, hBitmapHome);
BitBlt(hdc2, 90, 90, 40, 40, hdcMem, 0,0,SRCCOPY);
DeleteObject(hdcMem);
...
Problem is, that bitmap is under the button, not on it. Anyone has idea where I'm wrong?