0

How do I set an image to a button in a new dialog box(DialogBox2) which opens after clicking a button in a dialog box(DialogBox1)

case WM_INITDIALOG:

        hA1 = GetDlgItem(hDlg, IDD_SCORPIO);
        hbitmap=LoadImage(GetModuleHandle(NULL),MAKEINTRESOURCE(IMG_BITMAPAries),IMAGE_BITMAP,0, 0, LR_DEFAULTCOLOR);
        if(hbitmap==NULL)
            MessageBox(hDlg,"load fail","Load",MB_OK);
        else
            MessageBox(hDlg,"load pass","Load",MB_OK);

        if(SendMessage(hA1,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)hbitmap))
            MessageBox(hDlg,"set pass","Set Image",MB_OK);
        else
            MessageBox(hDlg,"set fail","Set Image",MB_OK);

the bitmap loads but I am unable to set the image.

4

1 回答 1

0

为您的按钮设置BS_BITMAP样式。

于 2015-04-13T17:16:26.067 回答