CBCGPCaptionBar的位置如下:
如图区域就是
MainFrame.h中声明:
CBCGPCaptionBar m_wndCaptionBar;
MainFrame.cpp中创建显示控件:
BOOL CMainFrame::CreateCaptionBar ()
{
if (!m_wndCaptionBar.Create (WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, this,
ID_VIEW_BAR_CAPTION, -1))
{
TRACE0("Failed to create caption bar\n");
return FALSE; // fail to create
}
m_wndCaptionBar.SetFlatBorder ();
m_wndCaptionBar.SetText (_T("<Put your caption here>"));
m_wndCaptionBar.m_clrBarText = RGB(255, 0, 0);
return TRUE;
}
OnCreate函数中调用创建的函数
同时设置字体大小
{
CFont *font = m_wndRibbonBar.GetFont();
LOGFONT lf;
font->GetLogFont(&lf);
lf.lfHeight = 30;
_tcscpy_s(lf.lfFaceName, LF_FACESIZE, _T("新宋体"));
m_fontCustom.CreateFontIndirect(&lf);
m_wndCaptionBar.SetFont(&m_fontCustom);
}