2009-12-02 33 views

回答

2

如果不使用MFC類使用CToolTipCtrl類的例子看About Tooltip Controls

這裏,

// Init a tooltip window  
m_ToolTipCtrl = new CToolTipCtrl; 
m_ToolTipCtrl->Create(this); // 'this', usually a CDialog window 

m_ToolTipCtrl->SetMaxTipWidth(300); // if you need multiline messages 
m_ToolTipCtrl->SetTipBkColor(0x000000); 
m_ToolTipCtrl->SetTipTextColor(0xe0e0d0); 

// Attach a CListBox control (we can attach many controls) 
m_ToolTipCtrl->AddTool(plstBox, "Hey, i am a tooltip message!"); 


// ... 
// (*) We must use the following in order to use tooltips (MFC 4.0 and later versions) 
BOOL MyDialog::PreTranslateMessage(MSG* pMsg) 
{ 
    if (NULL != m_ToolTipCtrl) 
     m_ToolTipCtrl->RelayEvent(pMsg); // <- listen mouse messages! 


    return CDialog::PreTranslateMessage(pMsg); 
} 
+0

我不使用MFC,但你鏈接緩解我的問題,謝謝你的回覆。 – 2009-12-02 13:42:56

相關問題