有两个问题需要解决: 1.关闭命令行对话框
代码:
CWnd *pWnd = acedGetAcadDockCmdLine();
if(pWnd)
{
pWnd = pWnd->GetParent();
if(pWnd)
{
pWnd = pWnd->GetParent();
if(pWnd)
{
pWnd->ModifyStyle(0,WS_VISIBLE|WS_OVERLAPPED);
pWnd->ShowWindow(SW_HIDE);
pWnd->RedrawWindow();
acedGetAcadFrame()->RecalcLayout();
}
}
}
已经解决。
2.程序启动时起作用 最初以为直接在On_kInitAppMsg消息中运行上述代码即可,事实上不起作用,感觉关闭之后又显示出来了。(另外如果要在On_kInitAppMsg消息中控制视图zoom-e也不可以,控制视图代码如下)
代码:
void CGlobalFuns::zoomExt()
{
// get the extents of the drawing
AcDbViewTableRecord view;
AcGePoint3d max =
acdbHostApplicationServices()->workingDatabase()->extmax(),
min = acdbHostApplicationServices()->workingDatabase()->extmin();
AcGePoint2d max_2d (max[X], max[Y]);
AcGePoint2d min_2d (min[X], min[Y]);
// now set the view centre point
view.setCenterPoint (min_2d + (max_2d - min_2d) / 2.0);
// now height and width of view
view.setHeight(max_2d[Y] - min_2d[Y]);
view.setWidth (max_2d[X] - min_2d[X]);
// set the view
acedSetCurrentView (&view, NULL);
// updates the extents
acdbHostApplicationServices()->workingDatabase()->updateExt(TRUE);
}
于是只好用AutoCAD2004doc.lsp实现,发现也不尽如人意,讨论一下。 |