메뉴 바로가기

서브메뉴 바로가기

본문 바로가기

logo

C/C++/MFC
툴팁을 이용하여 마우스 위치 나타내기 소스입니다.

  CToolTipCtrl*   m_pToolTip;  // 선언해 주고

OnInitDialog(){}   에서 생성해 주고

   m_pToolTip = new CToolTipCtrl;
   m_pToolTip->Create(this, TTS_ALWAYSTIP|TTS_NOPREFIX);
   m_pToolTip->SetDelayTime(500);
   m_pToolTip->Activate(TRUE);


void OnMouseMove(UINT nFlags, CPoint point){ // 마우스이동함수에서 출력해 주고
           CString strTemp;
        strTemp.Format("%5d,%5d",point.x,point.y);
//        strTemp.Format("%5ld",lUnitSize);
    m_pToolTip->Activate(TRUE);
    m_pToolTip->AddTool(this,strTemp, CRect(point.x-1,point.y-1,point.x+1,point.y+1), TRUE);    // skin[i].rc    각 버튼들의 Rect...
        m_pToolTip->Update();


        CDialog::OnMouseMove(nFlags, point);
}


BOOL CMy1Dlg::PreTranslateMessage(MSG* pMsg) { // 화면에 출력 이벤트 걸어주고
               m_pToolTip->RelayEvent(pMsg);        

        return CDialog::PreTranslateMessage(pMsg);
}