返回拾取矩形框的宽度,默认值为6
static void GetCursorPickRect(IN MXDRAWOCXHANDLE hOcx, OUT int& iWidth);
参数 |
说明 |
IN MXDRAWOCXHANDLE hOcx |
控件窗口句柄 |
OUT int& iWidth |
返回光标拾取框的大小,光标拾取框是个矩形框,宽度等于高度 |
返回当前光标的拾取框的大小,返回的是屏幕像素大小,光标拾取框是个矩形框,宽度等于高度 例如:下面的代码是得到鼠标点取位置下的实体,点取位置的实体搜索范围是由GetCursorPickRect函数的
BOOL MxTools::FindEntAtPoint(IN McGePoint3d pt,IN struct resbuf* pFilter, IN double dTol,OUT AcDbObjectIdArray& aryId) { aryId.setLogicalLength(0); McGePoint3d pt1 = pt + dTol * (AcGeVector3d::kXAxis + AcGeVector3d::kYAxis); McGePoint3d pt2 = pt - dTol * (AcGeVector3d::kXAxis + AcGeVector3d::kYAxis); ads_name ss; int result = acedSSGet(_T("_C"), asDblArray(pt1), asDblArray(pt2), pFilter, ss); if(result != RTNORM) { return FALSE; } long sslen; if (acedSSLength(ss, &sslen) != RTNORM) { acedSSFree(ss); return FALSE; } for(int i = 0; i < sslen;i++) { ads_name ent; acedSSName(ss, i, ent); AcDbObjectId id; acdbGetObjectId(id,ent); aryId.append(id); } acedSSFree(ss); return !aryId.isEmpty(); } LRESULT CWinMsg::OnViewLButtonDblClk(UINT nFlags, McGePoint2d point) { CPoint ptView((int)point.x,(int)point.y); McGePoint3d pt = MxDraw::ViewToDocCoord(m_hOcx,ptView); double dWidth = 1.0; double dHeight = 1.0; int iWidth = 6; MxDraw::GetCursorPickRect(m_hOcx,iWidth); dWidth = MxDraw::ViewLongToDocCoord(m_hOcx,iWidth); dHeight = dWidth; AcDbObjectIdArray aryId; MxTools::FindEntAtPoint(pt,NULL,dWidth / 2.0,aryId);