Add a picture to Picture Control in a dialog box (error RC2108: expected numerical dialog constant)

3.6k views Asked by At

I am trying to add a picture to a Picture Control in a dialog box. by following this page I added a .bmp format image (Size=457 KB) to the Resource view and then draw a Picture Control on the dialog box, finally in Picture Control properties I changed type to bitmap, Real Size Image to TRUE,Image Id: IDB_PICTURE1, Picture Control Id:IDC_PICTURE. After debugging I receive this error :

error RC2108: expected numerical dialog constant

By double clicking on error message compiler shows end of following line.

CONTROL         IDB_PICTURE1,IDC_PICTURE,102,98,222,125,SS_REALSIZEIMAGE | NOT WS_GROUP

and in Resource.h I see:

#define IDB_PICTURE1                    177
#define IDC_PICTURE                     1045

I followed a bunch of forums but I couldn't find any solution.

1

There are 1 answers

0
Pradeepa Senanayake On

I don't know the exact cause of the issue, but I also got this issue and by comparing .rc files our team devised a fix. It looks like when the Picture Control is added the internal VS engine does not properly modify the code in .rc file. That corrupts the rc file.

To fix this change the following line,

CONTROL   IDB_PICTURE1,IDC_PICTURE,102,98,222,125,SS_REALSIZEIMAGE | NOT WS_GROUP

to

CONTROL   IDB_PICTURE1,IDC_PICTURE,SS_BITMAP,102,98,222,125,SS_REALSIZEIMAGE | NOT WS_GROUP

I hope this will solve your issue. It solved the issue in my case.

This is an active bug in Visual Studio as mentioned here

They might fix this in their future releases.

Thank you.