在FormView的类中添加鼠标单击、双击消息,
void XXView::OnLButtonDblClk(UINT nFlags, CPoint point)

void XXView::OnLButtonDown(UINT nFlags, CPoint point)
{
     Crect rcStatic;
     GetDlgItem(IDC_STATIC)->GetWindowRect(&rcStatic);
     ScreenToClient(&rcStatic);
     if(point.x >rcStatic.left && point.x <rcStatic.right &&
          &&point.y >rcStatic.top  && point.y <rcStatic.bottom)
     {
         afxMessageBox("Click Static True!")
     }
}

解决方案 »

  1.   

    要设置静态文本框的属性有SS_NOTIFY样式,响应单击双击要修改文本框ID,在父窗口响应OnCommand即可
      

  2.   

    静态框不改ID的话不能进行响应函数,你改一下ID就可以为它添加响应函数了,然后自己实现功能就行了。
      

  3.   

    1、将静态文本的notify属性选中
    2、将他的ID修改成自己的ID,不要使用使用IDC_STATIC,就可以响应OnLButton消息了。
      

  4.   

    对话框的怎么添加呢
    void CMainDlg::OnLButtonDown(UINT nFlags, CPoint point)
    {
    MessageBox("in");
    CRect static1,static2,static3,static4,static5,static6,static7;//记录菜单的矩形区域
    GetDlgItem(IDC_STATIC_MENU16)->GetWindowRect(&static1);
    /*GetDlgItem(IDC_MAIN_8) ->GetWindowRect(&static2);
    GetDlgItem(IDC_MAIN_10)->GetWindowRect(&static3);
    GetDlgItem(IDC_MAIN_12)->GetWindowRect(&static4);
    GetDlgItem(IDC_MAIN_18)->GetWindowRect(&static5);
    GetDlgItem(IDC_MAIN_29)->GetWindowRect(&static6);
    GetDlgItem(IDC_MAIN_30)->GetWindowRect(&static7);*/
    ScreenToClient(&static1);
    /*CString str;
    str.Format(_T("%ld"),point.x);
    MessageBox(str);
    str.Format(_T("%ld"),static1.left);
    MessageBox(str);
    str.Format(_T("%ld"),static1.right);
    MessageBox(str);
    str.Format(_T("%ld"),point.y);
    MessageBox(str);
    str.Format(_T("%ld"),static1.top);
    MessageBox(str);
    str.Format(_T("%ld"),static1.bottom);
    MessageBox(str);*/
    if(point.x >static1.left && point.x <static1.right && point.y > static1.top  && point.y < static1.bottom)
    {
    MessageBox("Click Static True!");
    }
    }
    上面代码,在消息列表也有ON_WM_LBUTTONDOWN()
    为什么,还是不行恩?