TC_ITEM item; item.mask = TCIF_IMAGE; for (int i = 0; i < NUMBER_OF_TABS; i++) { item.iImage = i; pTabCtrl->SetItem (i, &item ); } return bResult; }
// Create and associate a tooltip control to the tab control of // CMyPropertySheet. CMyPropertySheet is a CPropertySheet-derived // class. BOOL CMyPropertySheet::OnInitDialog() { BOOL bResult = CPropertySheet::OnInitDialog();
// Create a tooltip control. m_ToolTipCtrl is a member variable // of type CToolTipCtrl* in CMyPropertySheet class. It is // initialized to NULL in the constructor, and destroyed in the // destructor of CMyPropertySheet class. m_ToolTipCtrl = new CToolTipCtrl; if (!m_ToolTipCtrl->Create(this)) { TRACE("Unable To create ToolTip\n"); return bResult; } // Associate the tooltip control to the tab control // of CMyPropertySheet. CTabCtrl* tab = GetTabControl(); tab->SetToolTips(m_ToolTipCtrl); // Get the bounding rectangle of each tab in the tab control of the // property sheet. Use this rectangle when registering a tool with // the tool tip control. IDS_FIRST_TOOLTIP is the first ID string // resource that contains the text for the tool. int count = tab->GetItemCount(); int id = IDS_FIRST_TOOLTIP; for (int i = 0; i < count; i++) { id += i; CRect r; tab->GetItemRect(i, &r); VERIFY(m_ToolTipCtrl->AddTool(tab, id, &r, id)); } // Activate the tooltip control. m_ToolTipCtrl->Activate(TRUE); return bResult; }// Override PreTranslateMessage() so RelayEvent() can be // called to pass a mouse message to CMyPropertySheet's // tooltip control for processing. BOOL CMyPropertySheet::PreTranslateMessage(MSG* pMsg) { if (NULL != m_ToolTipCtrl) m_ToolTipCtrl->RelayEvent(pMsg);
页面标题作为图像画上去,并附上你想要的颜色,不知仁兄有何意见?
BOOL CMyPropSheet::OnInitDialog ()
{
BOOL bResult = CPropertySheet::OnInitDialog(); m_imageList.Create (IDB_MYIMAGES, 13, 1, RGB(255,255,255));
CTabCtrl *pTabCtrl = GetTabControl ();
pTabCtrl->SetImageList (&m_imageList);
TC_ITEM item;
item.mask = TCIF_IMAGE;
for (int i = 0; i < NUMBER_OF_TABS; i++)
{
item.iImage = i;
pTabCtrl->SetItem (i, &item );
} return bResult;
}
// CMyPropertySheet. CMyPropertySheet is a CPropertySheet-derived
// class.
BOOL CMyPropertySheet::OnInitDialog()
{
BOOL bResult = CPropertySheet::OnInitDialog();
// Create a tooltip control. m_ToolTipCtrl is a member variable
// of type CToolTipCtrl* in CMyPropertySheet class. It is
// initialized to NULL in the constructor, and destroyed in the
// destructor of CMyPropertySheet class.
m_ToolTipCtrl = new CToolTipCtrl;
if (!m_ToolTipCtrl->Create(this))
{
TRACE("Unable To create ToolTip\n");
return bResult;
} // Associate the tooltip control to the tab control
// of CMyPropertySheet.
CTabCtrl* tab = GetTabControl();
tab->SetToolTips(m_ToolTipCtrl); // Get the bounding rectangle of each tab in the tab control of the
// property sheet. Use this rectangle when registering a tool with
// the tool tip control. IDS_FIRST_TOOLTIP is the first ID string
// resource that contains the text for the tool.
int count = tab->GetItemCount();
int id = IDS_FIRST_TOOLTIP;
for (int i = 0; i < count; i++)
{
id += i;
CRect r;
tab->GetItemRect(i, &r);
VERIFY(m_ToolTipCtrl->AddTool(tab, id, &r, id));
} // Activate the tooltip control.
m_ToolTipCtrl->Activate(TRUE); return bResult;
}// Override PreTranslateMessage() so RelayEvent() can be
// called to pass a mouse message to CMyPropertySheet's
// tooltip control for processing.
BOOL CMyPropertySheet::PreTranslateMessage(MSG* pMsg)
{
if (NULL != m_ToolTipCtrl)
m_ToolTipCtrl->RelayEvent(pMsg);
return CPropertySheet::PreTranslateMessage(pMsg);
}