vs2005MfC使用ontimer,Attach更新按钮颜色,没有变化,需要点击按钮才会触发。解决方法

    cnt=m_ListCtrl_Entity.GetItemCount();             
            CString show_content=L"有请求,请处理";
            CString no_show_content=L"无请求";
            if(cnt>0)
            {
            m_bSendMessage.Attach(IDC_BUTTON_SendMessage, this, RED, WHITE, DKGRAY);    
            Invalidate();
            SetDlgItemText(IDC_STATIC_entity_id_notification,show_content);

            }
            else
            {
            m_bSendMessage.Attach(IDC_BUTTON_SendMessage, this, BLUE, WHITE, DKGRAY);
            Invalidate();
            SetDlgItemText(IDC_STATIC_entity_id_notification,no_show_content);
            }
            m_bSendMessage.Attach(IDC_BUTTON_SendMessage, this, RED, WHITE, DKGRAY);
            Invalidate();

设置按钮颜色后:添加

Invalidate();

posted @ 2021-09-10 14:29  txwtech  阅读(74)  评论(0编辑  收藏  举报