Width of a CVIEW window / word wrap

Hi - I hope this is the right forum to ask this question...

I'm trying to find the width of a MFC CView window, so I can do line-breaking in the ondraw() function, so that my displayed text lines are visible and fit the window.

Unfortunately taking the device context pointer pDC and evaulating pDC->GetWindowExtent() gives me a size of 1,1. Since I was in the default mode MM_TEXT, I thought I should get a window size in pixels. I don't know if I'm using the wrong function, or have set anything up wrong in the window (but most everything about the window is the APPwizard default for an SDI application, including the base class of CView.).

Comments

  • : Hi - I hope this is the right forum to ask this question...
    :
    : I'm trying to find the width of a MFC CView window, so I can do line-breaking in the ondraw() function, so that my displayed text lines are visible and fit the window.
    :
    : Unfortunately taking the device context pointer pDC and evaulating pDC->GetWindowExtent() gives me a size of 1,1. Since I was in the default mode MM_TEXT, I thought I should get a window size in pixels. I don't know if I'm using the wrong function, or have set anything up wrong in the window (but most everything about the window is the APPwizard default for an SDI application, including the base class of CView.).
    :

    GetClientRect() will get you the CRect.
    [code]
    CRect rect;
    GetClientRect(rect);
    [/code]


  • : GetClientRect() will get you the CRect.
    : [code]
    : CRect rect;
    : GetClientRect(rect);
    : [/code]
    :

    Thanks! This worked.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories