Amit
Amit

Reputation: 703

Drawing image over static control

I'm trying to paint a Picture Box over Static Control, yet the image is not appearing.

The image do exist at the location.

Here is my code :

    HWND hwn = CreateWindow(TEXT("static"), NULL, WS_CHILD | WS_VISIBLE, 5, 10, 470, 100, hwnd, NULL, NULL, NULL);
    HBITMAP hBmp = (HBITMAP)LoadImage(NULL, "D:\\Pic.bmp", IMAGE_BITMAP, 100, 100, LR_LOADFROMFILE);  
SendMessage(hwn, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBmp);

First I'm creating a static control (just as the guides in google said), and then I'm painting the image over it... Why isnt it working ? It only draws the static control, but the image isnt being loaded at all...

Thanks!

Upvotes: 0

Views: 1047

Answers (1)

ScottMcP-MVP
ScottMcP-MVP

Reputation: 10415

You need SS_BITMAP style when creating the static control.

Upvotes: 6

Related Questions