Does anyone know how to convert screen coordinates to world coordinates for an AcGsView in a dialog control? I tried using the example as shown in BlockView sample but it doesn't come out as expected. What I want is to trap the mouse click event in the window and get the WCS coordinate of the point (CPoint) point clicked. The xform in the code below is as shown in the BlockView sample. Any ideas?
void PreviewCtrl::OnLButtonDown(UINT nFlags, CPoint point)
{
SetFocus();
if(pickingEnabled_)
{
AcGeMatrix3d xform = mpView->viewingMatrix()
* mpView->worldToDeviceMatrix().inverse());
AcGePoint3d pt = AcGePoint3d(point.x, -point.y, 0);
pt.transformBy(xform);
PointClicked(pt);
}
}