Link to home
Start Free TrialLog in
Avatar of Member_2_99151
Member_2_99151

asked on

Stretch text to fit CStatic

Hi all,

Does anyone know of an MFC CStatic (or CEdit if neccessary) based control that will stretch the text to fit???
I am using MFC 6.

Thanks,

James
Avatar of alb66
alb66
Flag of Italy image

Avatar of Member_2_99151
Member_2_99151

ASKER

Thanks for the information.

I have tried implementing this ( see following code )

The text displays fine but does not fit to the Client area...
What am I missing???

James
void CResizetextDlg::OnSize(UINT nType, int cx, int cy) 
{
   CDialog::OnSize(nType, cx, cy);
   CRect rct;
   this->GetClientRect(&rct);
   TextOut(this->GetDC()->m_hDC, rct, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
 
 
void CResizetextDlg::TextOut(HDC hdc, LPRECT lprect, LPSTR lpstr)
{
   // Code as per the article....
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of alb66
alb66
Flag of Italy image

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
Hi,

Thanks, I can work with that!

James