📄 subject_34364.htm
字号:
<p>
序号:34364 发表者:gaolea 发表日期:2003-03-29 10:24:06
<br>主题:急问: 如何改变CEdit box 中text 的color
<br>内容:CEdit and CWnd 中没有改变text 的color.<BR><BR>谢了
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:晚风也渡 回复日期:2003-03-29 10:45:28
<br>内容:用SetTextColor()<BR>(CEdit*)GetDlgItem(IDC_TEXT1)->SetTextColor(RGB(255,0,0));<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:gaolea 回复日期:2003-03-30 09:08:08
<br>内容:不对呀, SetTextColor(RGB()) is a function of CDC, can not used as a function of CWnd. Do you have other method?<BR><BR>Thank you.
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:晚风也渡 回复日期:2003-03-30 21:09:32
<br>内容:sorry,I am wrong.<BR>重载对话框的WM_CTLCOLOR消息,然后<BR>HBRUSH CConvertDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) <BR>{<BR> HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);<BR> <BR> // TODO: Change any attributes of the DC here<BR> pDC->SetTextColor(RGB(255,0,0));//加上这句话!<BR> <BR> // TODO: Return a different brush if the default is not desired<BR> return hbr;<BR>}
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:gaolea 回复日期:2003-03-31 08:38:04
<br>内容:我try 了一下, 不可以呀. 我想,是否重载一下CEdit.
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:晚风也渡 回复日期:2003-03-31 18:29:37
<br>内容:不会的呀,我给你发个例子吧。<BR>当然重载CEdit也是可以的。<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:gaolea 回复日期:2003-04-01 00:29:38
<br>内容:hi, the problem was figured out. Thank you very much!!!!!
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:gaolea 回复日期:2003-04-01 05:25:20
<br>内容:还有一事相求, 若用你给的方法, 所有的EDITBOX 的颜色都变了, 但我只想变其中的一个.而且,我重载了CEDIT,但是颜色不变,不知为什么?
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:gaolea 回复日期:2003-04-01 05:38:06
<br>内容:我是说, 没从键盘输入以前,text 是黑色, 更改text时,这个editbox de text变色.
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:gaolea 回复日期:2003-04-01 06:00:16
<br>内容:我搞定了
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:ice water 回复日期:2003-04-01 09:36:17
<br>内容:gaolea,能说说你是怎么搞定的吗,现在我也遇到和你类似的问题,上面的解决办法是直接在<BR>父类中指定的,所以进去就会字体颜色就会改变.<BR>我的邮箱是fanpc@21cn.com,方便的话,给我发一个好吗??
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:gaolea 回复日期:2003-04-01 22:23:54
<br>内容:There are two ways to figure it out. One is overloading the function CWnd::OnCtrlColor of the parent windows. Using widzrad to overload the WM_CtrlColor mesaage. Another method is Overloading the CEdit::OnCtrlColor function, and the be careful, you need create a new brush, and then this brush to hbru. If you also have some problem, please contact me.
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:ice water 回复日期:2003-04-02 08:59:18
<br>内容:其实,如果只是单纯的更改EDIT中的字体颜色倒是不难.但我现在是想改内嵌在MSFlexGrid中的EDIT,就有点问题了,看来是只能派生EDIT,再重载一下EDIT::ONCTRLCOLOR了.
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:gaolea 回复日期:2003-04-02 22:01:04
<br>内容:So, you got it. Congratulation!
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -