본문 바로가기

Windows/MFC

CToolTipCtrl

[code]CBalloonTipView::CBalloonTipView()
    : CFormView(CBalloonTipView::IDD)
{
    //{{AFX_DATA_INIT(CBalloonTipView)
        // NOTE: the ClassWizard will add member initialization here
    //}}AFX_DATA_INIT
    // TODO: add construction code here
    m_pTT = new CToolTipCtrl;
}

CBalloonTipView::~CBalloonTipView()
{
    delete m_pTT;
}

void CBalloonTipView::OnInitialUpdate()
{
    CFormView::OnInitialUpdate();
    GetParentFrame()->RecalcLayout();
    ResizeParentToFit();


    m_pTT->Create(this, TTS_BALLOON|WS_POPUP|WS_EX_TOOLWINDOW);
    m_pTT->AddTool(GetDlgItem(IDC_EDIT1), "Text 1");
    m_pTT->AddTool(GetDlgItem(IDC_EDIT2), "Text 2");
    m_pTT->AddTool(GetDlgItem(IDC_EDIT3), "Text 3");
    m_pTT->AddTool(GetDlgItem(IDC_EDIT4), "Text 4");
}

// 멀티라인 설정
m_tooltip.SendMessage(TTM_SETMAXTIPWIDTH, 0, 1000); 이 멀티라인 표시를 해 주도록 설정하는 부분입니


// Dialog 일때
BOOL CTooltipDlg::PreTranslateMessage(MSG* pMsg) {
    switch(pMsg->message) {
    case WM_LBUTTONDOWN:            
    case WM_LBUTTONUP:            
    case WM_MOUSEMOVE:
        // 툴팁을 보여줌
        m_tooltip.RelayEvent(pMsg);
    }
    return CDialog::PreTranslateMessage(pMsg);
}
[/code]

// ActiveX 일 때
ActiveX 콘트롤(FlexGrid, m_Grid)의 MouseMove이벤트안에서

[code]m_ToolTip.UpdateTipText("툴팁문자열",&m_Grid);[/code]

'Windows > MFC' 카테고리의 다른 글

CListCtrl NM_LISTVIEW Click event  (0) 2013.10.02
Modeless Window  (0) 2013.10.02
CScrollBar WM_HSCROLL  (0) 2013.10.02
Regexp Regular expression  (0) 2013.10.02
CListCtrl count of total items (GetItemCount)  (0) 2013.10.02