As I understood it, setting up ENM_REQUESTRESIZE
would issue EN_REQUESTRESIZE
to change the height (but not the width) per this article.
However, I found the call was changing the height and width. I only want the height to change. In my example the width was shorter than I want the rich text box so I just use the existing width, but the issue is the height was not high enough and cuts off the text.
Here’s what I did:
void CDialogX::OnEnRequestResize( NMHDR* pNMHDR, LRESULT* pResult )
{
_ASSERT( pNMHDR->code == EN_REQUESTRESIZE );
CRect rect;
m_ctlRichEdit.GetWindowRect(rect);
ScreenToClient(rect);
CDebugPrint::DebugPrint(_T("existing size %i %i %i %in"), rect.left, rect.top, rect.right, rect.bottom);
REQRESIZE* prr = (REQRESIZE*)pNMHDR;
m_ctlRichEdit.SetWindowPos(NULL, 0, 0, rect.Width(), prr->rc.bottom - prr->rc.top, SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOMOVE);
CDebugPrint::DebugPrint(_T("requested size %i %i %i %in"), prr->rc.left, prr->rc.top, prr->rc.right, prr->rc.bottom);
// get new size
m_ctlRichEdit.GetWindowRect(rect);
ScreenToClient(rect);
CDebugPrint::DebugPrint(_T("new size %i %i %i %in"), rect.left, rect.top, rect.right, rect.bottom);
// ...
*pResult=0;
}
The debug output was:
existing size 60 57 329 58
requested size 60 57 241 70
new size 60 57 329 70
What am I doing wrong?
1