Getting Latest Rectange & Window Size :: MFC

This is a discussion on Getting Latest Rectange & Window Size :: MFC within the C++ Programming forums, part of the General Programming Boards category; Hi. I have a rectangle of size: CRect recTmp = CRect(0, 0, 200, 200); In OnSize() message handler, I'd like ...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348

    Getting Latest Rectange & Window Size :: MFC

    Hi.

    I have a rectangle of size:

    CRect recTmp = CRect(0, 0, 200, 200);

    In OnSize() message handler, I'd like to center text and other items inside the rectangle based on the new sizeof the window.

    So, if the user resizes the window to CSize newSize(250, 250), the text and items new position will be (125, 125).

    Anyways, I need a way to get the most current size of the view rectangle in either CPoint or CSize.

    I have tried GetWindowOrg() and GetWindowExt(). I have not gotten any accurate size back from CDC.

    Thanks,
    Kuphryn

  2. #2
    Registered User rmullen3's Avatar
    Join Date
    Nov 2001
    Posts
    330
    GetSystemMetrics() or something like that...

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Thanks!

    Kuphryn

  4. #4
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    GetClientRect() ?

  5. #5
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Yes. GetClientRect() will return the updated size. OnSize() passes the updated size too.

    Kuphryn

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting interior window size
    By ulillillia in forum Windows Programming
    Replies: 3
    Last Post: 03-21-2009, 07:27 PM
  2. Error with a vector
    By Tropicalia in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2006, 07:45 PM
  3. My Window Class
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 07-10-2005, 02:33 PM
  4. Adding colour & bmps to a Win 32 Window??
    By carey_sizer in forum Windows Programming
    Replies: 4
    Last Post: 09-04-2004, 05:55 PM
  5. Invoking MSWord
    By Donn in forum C Programming
    Replies: 21
    Last Post: 09-08-2001, 04:08 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21