Hi,

Msdn says for SetBitmap(): "The bitmap will be automatically drawn in the static control. By default, it will be drawn in the upper-left corner and the static control will be RESIZED TO THE SIZE OF THE BITMAP."

So in the following:
Code:
		CRect r1,r2,r3;
		GetWindowRect(&r1);//the width of the CStatic as I want it
		SetBitmap(bitmap); 
		GetWindowRect(&r2);//r2 has the width and height of the bitmap
This code is executed in my CPicture class, which is a CStatic. This CPicture instance is a control on a dialog. What I want is that the dimensions (only width and height) are set again to the ones of r1 after doing SetBitmap()! The coordinate of the left upper corner (the position of the CStatic control on the dialog) must remain the same!

How can I do this? How can I put the size of the static back to the original size (which is r1)?


I already tried to do ScreenToClient(r1); MoveWindow(r1) after the SetBitmap() call; but then the CStatic position is at (0,0) in dialog coordinates. So in the left upper corner of the dialog; that is not where I want my CStatic to be.

Probably an easy solution exists.

Greets