-
November 3rd, 2004, 06:17 PM
#1
Problem resizing control in dialog!
Hi Gurus!
I've a very weird problem! I want to resize a picture control inside a dialog. I designed the dialog including its controls.
In the program I wrote the following lines:
// Get window size
CRect rect;
m_preview.GetWindowRect(&rect);
m_preview.MoveWindow(&rect);
It should show the control exactly the same as I placed it inside the dialog.....but it moves the picture control a few pixels down.
Any ideas why is this happening?
Thanks!
-
November 3rd, 2004, 07:14 PM
#2
Re: Problem resizing control in dialog!
Run thru debugger for actual values of the RECT and also read up documentation on MSDN. You'll figure out whats happening..
-
November 3rd, 2004, 07:34 PM
#3
Re: Problem resizing control in dialog!
You should convert the rectangle from the screen to the client coordinates of the dialog before you call MoveWindow function.
Code:
CRect rect;
m_preview.GetWindowRect(&rect);
this->ScreenToClient(rect);
m_preview.MoveWindow(&rect);
// where this is a pointer to your dialog box
Last edited by amarcode; November 4th, 2004 at 08:01 AM.
A.M.
My Latest Articles:
CCustomBitmapButton - An owner-draw button and a frame for the caption bar, in one class.
CCustomTabCtrl - A clone of the Excel tab sheet control.
-
November 4th, 2004, 12:47 PM
#4
Re: Problem resizing control in dialog!
Thanks a lot for all your help!
-
November 5th, 2004, 08:21 PM
#5
Re: Problem resizing control in dialog!
Originally Posted by amarcode
// where this is a pointer to your dialog box
[/code]
this is absolutely unnecessary.
There are only 10 types of people in the world:
Those who understand binary and those who do not.
-
November 6th, 2004, 11:25 AM
#6
Re: Problem resizing control in dialog!
Originally Posted by JohnCz
this is absolutely unnecessary.
I know it. I only wanted to point that the code shuld be placed in the dialog box class.
A.M.
My Latest Articles:
CCustomBitmapButton - An owner-draw button and a frame for the caption bar, in one class.
CCustomTabCtrl - A clone of the Excel tab sheet control.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|