How to remove a close button from an MFC title bar

Is there an easy way to remove the close button from the title bar of an MFC package?

(I do not mean the window title, I am talking about a small information panel that can be displayed at the top of the client area in these applications, that is: CMFCCaptionBar)

thanks

+3
source share
2 answers

Figured out one way ...

class CNoCloseCaptionBar : public CMFCCaptionBar
{
public:
    CNoCloseCaptionBar()
    {
    }

    virtual void RecalcLayout()
    {
        __super::RecalcLayout();
        m_rectClose.SetRectEmpty();
    }

};
+2
source

Removing a bitmap worked for me. See the MSOffice2007Demo example in Feature Visual C ++ 2008.

Comment the following line in the CMainFrame: CreateMessageBar ()

//m_wndMessageBar.SetBitmap(IDB_INFO, RGB(255, 255, 255), FALSE, CMFCCaptionBar::ALIGN_LEFT);

Caption Bar without a close button enter image description here

0
source

Source: https://habr.com/ru/post/1708050/


All Articles