Mohammad Usman
Mohammad Usman

Reputation: 43

Syntax error when using SS_REALSIZECONTROL in picture control

I am making a dialog based win32 gui application. I am basically making a gui to operate AVL tree. This is the look of the application:

image

I have a picture control to display a bitmap which is generated from .gv file consisting of dot language to display a graph. The bitmap is being generated as it should.

In my resource.rc file, this is my picture control definition

CONTROL "", ID_PIC, WC_STATIC, WS_BORDER | SS_BITMAP | SS_CENTERIMAGE, 165, 30, 410, 218, WS_EX_LEFT

And this is the view when bitmap loads in the picture control:

image

The bitmap is correct but it is being cropped, I want the picture control to fully display the bitmap. What should I do?

I also tried to use SS_REALSIZECONTROL, but it gives me a syntax error.

Upvotes: 2

Views: 1280

Answers (1)

Barmak Shemirani
Barmak Shemirani

Reputation: 31599

The correct usage for SS_REALSIZECONTROL is as follows:

CONTROL IDB_BITMAP1,IDC_X,"Static",SS_BITMAP|SS_CENTERIMAGE|SS_REALSIZECONTROL|WS_BORDER,136,7,121,145

This will shrink the bitmap if necessary and center it in the middle of static control.

SS_REALSIZECONTROL requires at least Windows XP target, it is defined as

#if(WINVER >= 0x0501)
#define SS_REALSIZECONTROL  0x00000040L
#endif /* WINVER >= 0x0501 */

If you are not using newer versions of Visual Studio you may need to declare WINVER >= 0x0501 or use the constant value 0x00000040L

Upvotes: 3

Related Questions