标题:diffcult problem.who can answer it?
只看楼主
虚拟现实
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2005-5-31
 问题点数:0 回复次数:2 
diffcult problem.who can answer it?
Visual C++6.0 environment.
Use API function.
There is a edit box.its id is EDIT1,its hwnd is hedit.
When you type character in the edit box .the color of the character is red.
How to do?
搜索更多相关主题的帖子: problem answer diffcult 
2005-05-31 18:01
mountain
Rank: 1
等 级:新手上路
帖 子:44
专家分:0
注 册:2005-5-28
得分:0 
CEdit *pEdit = (CEdit*)GetDlgItem(IDC_EDIT1);
 CDC *pDC = pEdit->GetDC();
 pDC->SetTextColor(RGB(255,0,0));
 CString str;
 GetDlgItemText(IDC_EDIT1,str);
 CRect rect;
 pEdit->GetClientRect(&rect);
 pDC->DrawText(str,&rect,DT_SINGLELINE);
 pEdit->ReleaseDC(pDC);
2005-06-01 23:10
mountain
Rank: 1
等 级:新手上路
帖 子:44
专家分:0
注 册:2005-5-28
得分:0 

上面的不对 这样才好 HBRUSH CDdDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

if(nCtlColor == CTLCOLOR_EDIT) { if(pWnd->GetDlgCtrlID() == IDC_EDIT1) { pDC->SetTextColor(RGB(255,0,0));//改变字体颜色 } } return hbr; }

2005-06-02 19:36



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-19784-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.245048 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved