title: How to auto resize the text control in mfc
body: <p>I want to put the text in my  IDC_TEXT in MFC. I want to auto resize that control with input text. I used my code but it does not work. Could you help me resolve it?</p>
  
  <pre><code>CFont *m_Font1 = new CFont;
  CStatic * m_Label;
  m_Font1-&gt;CreatePointFont(200, "Time New Roman");
  m_Label = (CStatic *)GetDlgItem(IDC_TEXT);
  m_Label-&gt;SetFont(m_Font1);
  m_Label-&gt;SetWindowText( _T("") );
  //Display text in thread
  THREADSTRUCT*    ts = (THREADSTRUCT*)param;
  CDC* vDC_TXT;
  vDC_TXT =ts-&gt;_this-&gt;GetDlgItem(IDC_TEXT)-&gt;GetDC();
  ts-&gt;_this-&gt;GetDlgItem(IDC_TEXT)-&gt;SetWindowTextA(text.c_str());
   //Update the length-
   ts-&gt;_this-&gt;GetDlgItem(IDC_TEXT)-&gt;SetWindowPos(NULL, 0, 0, 1000, 1000, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
  </code></pre>
  
  <p>However, the number (1000,1000) is set by my hand. I want to auto change based on the text size. Could you have me to solve it?</p>