15,979
社区成员
发帖
与我相关
我的任务
分享
void CMyListBox::OnLButtonDown()
{
//先用GetTopIndex、ItemFromPoint等获取点击的是哪一项
if((index == 0) || (index == 1))
return;
CListBox::OnLButtonDown()
}
BOOL CxxxxDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if((pMsg->message == WM_LBUTTONDOWN) && (pMsg->hwnd==m_ListBox.m_hWnd))
{//
CRect rc;
POINT pt=pMsg->pt;
m_ListBox.ScreenToClient(&pt);
int all=m_ListBox.GetCount();
for(int jj=0;jj<all;jj++)
{// hit test
m_ListBox.GetItemRect(jj,&rc);
// afxDump << rc << ";" << pt<< "\n";
if(rc.PtInRect(pt))
{
if(jj==DEF_SEL1 || jj==DEF_SEL2)
{// no change
//afxDump << jj << "\n";
return TRUE;;
}
}
}
}
//
return CDialog::PreTranslateMessage(pMsg);
}