yoavo
asked on
set height of output window
hi,
I have an output window in my application, based on an CEdit object. (with multiline style)
I set its height to contain 2 lines(if working on small fonts).
The problem is that when working in large fonts I can see only a little bit more than one line.
how can I calculate the height which I need to set the CEdit Ctrl, in a way that it will contain 2 lines both in small and large fonts ??
Yoav.
I have an output window in my application, based on an CEdit object. (with multiline style)
I set its height to contain 2 lines(if working on small fonts).
The problem is that when working in large fonts I can see only a little bit more than one line.
how can I calculate the height which I need to set the CEdit Ctrl, in a way that it will contain 2 lines both in small and large fonts ??
Yoav.
Hi,
Just try by putting this code in the OnIntitDialog for that dialog.
TEXTMETRIC txtmat;
CRect rect;
CClientDC dc(this);
dc.GetTextMetrics(&txtmat) ;
m_ctrlFontEdit.GetWindowRe ct(&rect);
ScreenToClient(&rect);
m_ctrlFontEdit.SetWindowPo s(&m_ctrlF ontEdit.wn dTop,10,10 , 100, txtmat.tmHeight*2, SWP_SHOWWINDOW);
Here m_ctrlFontEdit in the control variable to that edit control.
Try it out.
VinExpert
Just try by putting this code in the OnIntitDialog for that dialog.
TEXTMETRIC txtmat;
CRect rect;
CClientDC dc(this);
dc.GetTextMetrics(&txtmat)
m_ctrlFontEdit.GetWindowRe
ScreenToClient(&rect);
m_ctrlFontEdit.SetWindowPo
Here m_ctrlFontEdit in the control variable to that edit control.
Try it out.
VinExpert
Actually, use txtmat.tmHeight + txtmat.tmExternalLeading to get the height of your line...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If U can get the font type(small or large), then using that calculate the height(may be it will be constant), then set the hieght of the edit control using the MoveWindow() function.
((CEdit *)GetDlgItem(ID_EDIT1))->M
Try it out.
VinExpert