Click here to Skip to main content
13,046,281 members (109,694 online)
Rate this:
Please Sign up or sign in to vote.
How to change the position and size of static element in dialog based Mfc?

I have a CStatic box by drag and drop now I want to change the position and size of that element in the code. How can I do this?
CStatic *pWnd= (CStatic *)GetDlgItem(IDC_STATIC_PICTURE); //Id of CStatic Control

I got rcRect but how to set the new rect value what is the function used to set new rect values.
Posted 3-May-12 20:08pm
Updated 4-May-12 0:15am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I guess GetClientRect and MoveWindow Will help you on that.
Look at this link. [^]
chaiein 4-May-12 5:14am
no move window making it disappear
Chandrasekharan P 4-May-12 5:19am
Did you try setWindowPos function?
chaiein 4-May-12 5:38am
Thank u for suggesting this solution:) but its showing how to drag and drop dynamically but I need to show the position using CRect(value1,value2,value3,value4));
chaiein 4-May-12 5:42am
I need to use CRect because I have png of different size so if i change the element size so i can adjust the picture
chaiein 4-May-12 6:15am
please check my updated question.
JackDingler 4-May-12 15:12pm
Make sure that you're properly changing coordinate systems between client and screen. ScreenToClient() ClientToScreen()...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 4 May 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100