<tfoot id='2fWAm'></tfoot>
    <bdo id='2fWAm'></bdo><ul id='2fWAm'></ul>

      <small id='2fWAm'></small><noframes id='2fWAm'>

      <legend id='2fWAm'><style id='2fWAm'><dir id='2fWAm'><q id='2fWAm'></q></dir></style></legend>
    1. <i id='2fWAm'><tr id='2fWAm'><dt id='2fWAm'><q id='2fWAm'><span id='2fWAm'><b id='2fWAm'><form id='2fWAm'><ins id='2fWAm'></ins><ul id='2fWAm'></ul><sub id='2fWAm'></sub></form><legend id='2fWAm'></legend><bdo id='2fWAm'><pre id='2fWAm'><center id='2fWAm'></center></pre></bdo></b><th id='2fWAm'></th></span></q></dt></tr></i><div id='2fWAm'><tfoot id='2fWAm'></tfoot><dl id='2fWAm'><fieldset id='2fWAm'></fieldset></dl></div>

      1. MFC:更改 CEdit 的颜色

        时间:2023-10-06
            <tbody id='hQuKL'></tbody>

          • <bdo id='hQuKL'></bdo><ul id='hQuKL'></ul>

              <small id='hQuKL'></small><noframes id='hQuKL'>

              • <legend id='hQuKL'><style id='hQuKL'><dir id='hQuKL'><q id='hQuKL'></q></dir></style></legend>
                • <tfoot id='hQuKL'></tfoot>
                • <i id='hQuKL'><tr id='hQuKL'><dt id='hQuKL'><q id='hQuKL'><span id='hQuKL'><b id='hQuKL'><form id='hQuKL'><ins id='hQuKL'></ins><ul id='hQuKL'></ul><sub id='hQuKL'></sub></form><legend id='hQuKL'></legend><bdo id='hQuKL'><pre id='hQuKL'><center id='hQuKL'></center></pre></bdo></b><th id='hQuKL'></th></span></q></dt></tr></i><div id='hQuKL'><tfoot id='hQuKL'></tfoot><dl id='hQuKL'><fieldset id='hQuKL'></fieldset></dl></div>
                • 本文介绍了MFC:更改 CEdit 的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  伙计们,谁能简要介绍一下如何在运行时更改 CEdit 控件的背景颜色?如果字段长度为零,我希望能够将背景更改为红色,否则为正常白色.

                  Guys, can someone give me a brief run through of how to change the background colour of a CEdit control at runtime? I want to be able to change the background to red if the field is zero length and the normal white otherwise.

                  推荐答案

                  你不能用一个普通的 CEdit 来完成,你需要覆盖一些位.

                  You cannot do it with a plain CEdit, you need to override a few bits.

                  实现您自己的 ON_WM_CTLCOLOR_REFLECT 处理程序,然后在处理程序中返回您的彩色 CBrush:

                  Implement your own ON_WM_CTLCOLOR_REFLECT handler, then return your coloured CBrush in the handler:

                  (粗略地说,你需要把常用的资源管理放在那里,记住在析构函数中删除你的画笔)

                  (roughly, you'll need to put the usual resource management in there, rememebr to delete your brush in the destructor)

                  class CColorEdit : public CEdit
                  {
                    ....
                    CBrush   m_brBkgnd;
                    afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor)
                    {
                      m_brBkgnd.DeleteObject();
                      m_brBkgnd.CreateSolidBrush(nCtlColor);
                    }
                  }
                  

                  这篇关于MFC:更改 CEdit 的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:VS2003 C++ 中异常的堆大小限制 下一篇:不可复制的对象和值初始化:g++ 与 msvc

                  相关文章

                  最新文章

                  <legend id='yECEA'><style id='yECEA'><dir id='yECEA'><q id='yECEA'></q></dir></style></legend>

                      <i id='yECEA'><tr id='yECEA'><dt id='yECEA'><q id='yECEA'><span id='yECEA'><b id='yECEA'><form id='yECEA'><ins id='yECEA'></ins><ul id='yECEA'></ul><sub id='yECEA'></sub></form><legend id='yECEA'></legend><bdo id='yECEA'><pre id='yECEA'><center id='yECEA'></center></pre></bdo></b><th id='yECEA'></th></span></q></dt></tr></i><div id='yECEA'><tfoot id='yECEA'></tfoot><dl id='yECEA'><fieldset id='yECEA'></fieldset></dl></div>
                      <tfoot id='yECEA'></tfoot>
                        <bdo id='yECEA'></bdo><ul id='yECEA'></ul>
                    1. <small id='yECEA'></small><noframes id='yECEA'>