Comment changer la couleur du texte RibbonStatusBarPane?
-
04-10-2019 - |
Question
Mon application utilise MFC Ruban (VS2008 + Feature pack9). Je ne suis pas en mesure de changer la fonction RibbonStatus Bar texte volet color.I passer outre le DrawPaneText int virtuel (CDC * pDC, const CString & strText, CRect rectText, UINT uiDTFlags), mais les choses ne fonctionnent pas.
non Ruban Barre d'état il y a une fonction SetPaneTextColor void (int nIndex, COLORREF ClrText = (COLORREF) -1, BOOL bUpdate) pour la couleur du texte changement de volet.
comment faire cela dans MFCRibbonStatusBarPane?
La solution
class MyPane : public CMFCRibbonStatusBarPane
{
public:
MyPane(){};
MyPane(
UINT nCmdID,
LPCTSTR lpszText,
BOOL bIsStatic = FALSE,
HICON hIcon = NULL,
LPCTSTR lpszAlmostLargeText = NULL)
:CMFCRibbonStatusBarPane(nCmdID,
lpszText,bIsStatic,hIcon,lpszAlmostLargeText){}
MyPane(
UINT nCmdID,
LPCTSTR lpszText,
HBITMAP hBmpAnimationList, list
int cxAnimation = 16,
COLORREF clrTrnsp= RGB(192,192,192),
HICON hIcon = NULL,
BOOL bIsStatic = FALSE)
:CMFCRibbonStatusBarPane(nCmdID,lpszText,
hBmpAnimationList,cxAnimation,clrTrnsp,hIcon,bIsStatic){}
MyPane(
UINT nCmdID,
LPCTSTR lpszText,
UINT uiAnimationListResID,
int cxAnimation = 16,
COLORREF clrTrnsp= RGB(192,192,192),
HICON hIcon = NULL,
BOOL bIsStatic = FALSE)
:CMFCRibbonStatusBarPane(nCmdID,lpszText,
uiAnimationListResID,cxAnimation,clrTrnsp, hIcon,bIsStatic){}
~MyPane(){};
virtual COLORREF OnFillBackground(CDC* pDC)override
{
return RGB(255,0,0); //return whatever new color you want
}
};
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
[...]
m_wndStatusBar.AddElement(new MyPane(ID_STATUSBAR_PANE1, strTitlePane1, TRUE), strTitlePane1);
m_wndStatusBar.AddExtendedElement(new MyPane(ID_STATUSBAR_PANE2, strTitlePane2, TRUE), strTitlePane2);
[...]
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow