question

helloworld-1810 avatar image
0 Votes"
helloworld-1810 asked RoyLi-MSFT edited

About the dialog question of CMFC

question
recently I'm learning MFC dialog ,when I build a CFontDialog.I find i can only change the character pattern of the font,the color cannot be changed,I find some materials,but there aren't the result that I want to get in them.my IDE is vs.

 void CMFCApplication1Dlg::OnBnClickedButton1()
 {
  CFont* a = m_text.GetFont();
  LOGFONT logfont;
  a->GetLogFont(&logfont);
  CFontDialog dlg(&logfont);
  COLORREF color;
  if (dlg.DoModal() == IDOK)
  {
  m_font.Detach();
  LOGFONT temp;
  dlg.GetCurrentFont(&temp);;
  m_font.CreateFontIndirect(&temp);
  color=dlg.GetColor();
  m_text.SetFont(&m_font);
  CDC* pORIDC = GetDlgItem(IDC_EDIT1)->GetDC();
  HDC hdc = pORIDC->GetSafeHdc();
  SetTextColor(hdc,color);
  }
 }


not-supported
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

DSPatrick avatar image
0 Votes"
DSPatrick answered

QnA currently supports the products listed here (more to be added) Better to reach out to subject matter experts in dedicated forums over here.


https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vcgeneral


(please don't forget to mark helpful replies as answer)


Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management


Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.





5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.