Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all ,
I have created a dialog based application .I have taken a text control which I need to change for its size to accommodate more text for that text control for some specific requirement but need to do it through code not by simply stretching it .

I thought to change its size when InitDialog() is called but I am not getting that piece of code to that .
IDC_STATIC is the control Id of text control .

I want to do something like that
GetDlgItem(IDC_STATIC)->SetRectangleSize(co-ordinates for the rectangle)
Kindly provide me correct version of the solution .
Posted

Use the CWnd::SetWindowPos[^] function to change the dimension of the control at run-time.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 26-Oct-12 16:01pm    
Nearly one-to-one mapping to Win32 API. My 5.
--SA
CPallini 26-Oct-12 16:07pm    
Welcome to MFC. :-)
Sergey Alexandrovich Kryukov 26-Oct-12 17:20pm    
Who would doubt that..? :-)
--SA
André Kraak 26-Oct-12 16:02pm    
Thanks.
Change id to IDC_STATIC_1 or something that makes it unique and the code
C++
GetDlgItem(IDC_STATIC_1)->SetRectangleSize(co-ordinates for the rectangle);

should do what you are looking for
The example I have shown stresses on the dialog item id and not the actual method you need to get your job done.
 
Share this answer
 
v2
you can see HWND::movewindow API in MSDN
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900