Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Resizing Controls at run time

Posted on 2002-07-14
2
Medium Priority
?
166 Views
Last Modified: 2013-11-20
I need to resize the window controls like CStatic, CButton etc. at run time. Is there any way to do it?

Thanks.
0
Comment
Question by:theExpert
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
mnashadka earned 150 total points
ID: 7153383
You can use the "MoveWindow" member function of CWnd after GetClientRect and Client To Screen.  For instance:

   CRect buttonRect;
   m_button.GetClientRect(&buttonRect);

   m_button.ClientToScreen(buttonRect);

   // Make it 20 px wider
   buttonRect.left -= 10;
   buttonRect.right += 10;

   m_button.MoveWindow(buttonRect.left, buttonRect.top,
      buttonRect.Width(), buttonRect.Height());
0
 

Expert Comment

by:Nanos
ID: 7156834
CRect Rect;

<yourControl>.GetWindowRect(&Rect);
<yourControl>.SetWindowPos(NULL,0,0,Rect.Width(),211,SWP_NOMOVE | SWP_NOZORDER);

The SetWindowPos Function takes width and height parameters. these will enable you to change the size and location of your controls.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question