locked
How to get window size RRS feed

  • Question

  • In my VC++ MFC CAD program, I have a device context (CDC*). How do I determine the current size (extent) of the window? So that I can skip the objects that I am drawing that are outside of my viewing window.

    Thank you,

     
    Wednesday, June 1, 2016 11:39 PM

Answers

  • On 6/1/2016 7:39 PM, mh1000 wrote:

    In my VC++ MFC CAD program, I have a device context (CDC*). How do I determine the current size (extent) of the window? So that I can skip the objects that I am drawing that are outside of my viewing window.

    You are probably looking for GetClipBox, RectVisible and/or PtVisible.

    • Proposed as answer by Baron Bi Thursday, June 2, 2016 3:20 AM
    • Marked as answer by Baron Bi Tuesday, June 14, 2016 9:03 AM
    Thursday, June 2, 2016 12:11 AM

All replies

  • On 6/1/2016 7:39 PM, mh1000 wrote:

    In my VC++ MFC CAD program, I have a device context (CDC*). How do I determine the current size (extent) of the window? So that I can skip the objects that I am drawing that are outside of my viewing window.

    You are probably looking for GetClipBox, RectVisible and/or PtVisible.

    • Proposed as answer by Baron Bi Thursday, June 2, 2016 3:20 AM
    • Marked as answer by Baron Bi Tuesday, June 14, 2016 9:03 AM
    Thursday, June 2, 2016 12:11 AM
  • Thank you for the reply. I think these will help me.

    Makoto

    Thursday, June 2, 2016 4:58 PM
  • In case of normal painting with WM_PAINT and CPaintDC, see also the m_ps member, which offers the rectangle that is to be drawn. It does not include the areas that are still valid. See also CWnd::GetUpdateRgn, but it has to be called before making a CPaintDC or before making a CDC with CWnd::BeginPaint.


    • Edited by Viorel_MVP Thursday, June 2, 2016 6:26 PM
    Thursday, June 2, 2016 6:18 PM