CDC修改窗口背景出问题<br /><br />一个通讯程序的界面,用VC++,这样写<br />是想实现:如果通讯正常,某个CEDIT的背景是绿色,如果通讯异常,背景为红色<br />现在这个程序跑是能跑,有一个麻烦,如果这个窗口前面叠加了一窗口,关闭这个叠加的窗口後,原先有颜色的地方都是白色。但是文字还在<br /><br />这个部分要怎么改呀?<br /><br /> CDC *dc=this->edit_communication_status.GetDC();<br /> dc->SetTextColor(SCS_BLACK);<br /> CString str,s2;<br /> s2=" ";<br /> switch(scs_status)<br /> {case const_comm_timeout_error:<br /> str.Format("通讯超时,重试次数=%d",scs_sub_param);<br /> dc->SetBkColor(SCS_RED);<br /> break;<br /> case const_comm_ok:<br /> str.Format("通讯正常");<br /> dc->SetBkColor(SCS_GREEN);<br /> s2+=" ";<br /> break;<br /> case const_comm_packge_format_error:<br /> str.Format("接收的数据包编码错误,错误=%d",this->scs_sub_param);<br /> char error[100];<br /> this->communcation_protocol_stack.explain_value_error_type_of_packge_format(&error[0]);<br /> str+=error;<br /> dc->SetBkColor(SCS_YELLOW);<br /> break;<br /> case const_comm_undefine_error:<br /> str.Format("未知通讯错误,参数=%d",scs_sub_param);<br /> dc->SetBkColor(SCS_BLUE);<br /> break;<br /> }<br /> //this->edit_communication_status.SetWindowText(str);<br /> str+=s2;<br /> dc->TextOut(0,0,str); <br /> |
|