Thank u , but this method can't draw the text in the edit contol.
P
paraGOD
@paraGOD
Posts
-
How to get a dynamic created control's dc -
How to get a dynamic created control's dcI need to create a control dynamicly and then get its DC to draw text and so on,just do as the following code: BOOL bCreate = m_hEdit.Create(WS_CHILD | WS_TABSTOP | WS_VISIBLE |ES_LEFT , rectEdit,this, IDC_COMBOTREE_EDIT); if (bCreate) { CWnd* pParent = GetParent (); CFont* pFont = pParent->GetFont (); m_hEdit.SetFont (pFont); } CDC *dc=m_hEdit.GetDC(); dc->DrawTextW(_T("ok"),-1,CRect(0,0,30,20),DT_LEFT); dc->SetBkColor(RGB(0,0,0)); m_hEdit.ReleaseDC(dc); but it doesn't work,I can never see the "ok" in the edit. Any help is appricited. Thanks! para