Link to home
Start Free TrialLog in
Avatar of yoavo
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.
Avatar of Vinayak Kumbar
Vinayak Kumbar

Hi,

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))->MoveWindow(...);

Try it out.

VinExpert
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.GetWindowRect(&rect);
ScreenToClient(&rect);
      m_ctrlFontEdit.SetWindowPos(&m_ctrlFontEdit.wndTop,10,10, 100, txtmat.tmHeight*2, SWP_SHOWWINDOW);

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
Avatar of Vinayak Kumbar
Vinayak Kumbar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial