- This topic has 3 replies, 2 voices, and was last updated 14 years ago by Chike.
Viewing 4 posts - 1 through 4 (of 4 total)
-
AuthorPosts
-
February 28, 2010 at 7:12 pm #191115ashaMember
i have a string whose textcolor is to be changed as selected by user from colordialog ?
CDC *hWndDC;//declared this globally
COLORREF m_crColor; //in header fileCString strTitle; void CMainWnd::OnTimer(UINT_PTR nIDEvent) { ...................... hWndDC->TextOut(pt.x,5,strTitle,(char)strlen(strTitle)); ......... } void CMainWnd::OnTimeSettings() //menu p0 { CColorDialog colorDlg; if (colorDlg.DoModal() == IDOK) { m_crColor = colorDlg.GetColor(); hWndDC->SetTextColor(m_crColor); } }
m_crColor is to be assigned to strTitle ( SDI );
how should i do ?plz give me an idea
i found (when i debugged the program) that m_crColor has the color that i selected from the color dialog but i am not able to assign it to the strTitle.
February 28, 2010 at 11:37 pm #191118ChikeMembersprintf?
Why do you cast strlen to char?
March 1, 2010 at 8:33 am #191117ashaMemberbecause the last argument is
nCount = Specifies the number of bytes in the stringvoid CMainWnd::OnTimeSettings()//is a menu item { CColorDialog colorDlg; if (colorDlg.DoModal() == IDOK) { m_crColor = colorDlg.GetColor(); hWndDC->SetTextColor(m_crColor); } }
why is this not working ? what should i do ?
March 1, 2010 at 7:52 pm #191116 -
AuthorPosts
Related
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.