107 lines
2.5 KiB
C++
107 lines
2.5 KiB
C++
// ViewObjDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "resource.h"
|
|
#include "ViewObjDlg.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CViewObjDlg dialog
|
|
|
|
IMPLEMENT_DYNAMIC(CViewObjDlg, CModelessDialog)
|
|
|
|
CViewObjDlg::CViewObjDlg(CWnd* pParent /*=NULL*/)
|
|
: CModelessDialog(CViewObjDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CViewObjDlg)
|
|
// NOTE: the ClassWizard will add member initialization here
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
|
|
void CViewObjDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CModelessDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CViewObjDlg)
|
|
// NOTE: the ClassWizard will add DDX and DDV calls here
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CViewObjDlg, CModelessDialog)
|
|
//{{AFX_MSG_MAP(CViewObjDlg)
|
|
ON_WM_CREATE()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CViewObjDlg message handlers
|
|
|
|
BOOL CViewObjDlg::OnInitDialog()
|
|
{
|
|
CModelessDialog::OnInitDialog();
|
|
|
|
// TODO: Add extra initialization here
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
void CViewObjDlg::ViewObj(const TEntityBase *pEnt)
|
|
{
|
|
CWnd *pImageBox=GetDlgItem(IDC_OBJVIEW);
|
|
ASSERT(pImageBox);
|
|
CRect rect;
|
|
pImageBox->GetClientRect(rect);
|
|
CDC *pDC=pImageBox->GetDC();
|
|
m_image.InitDC(pDC, rect,GetAcadBackColor());
|
|
m_image.Reset();
|
|
pEnt->ExplodeOrDraw2d(m_image);
|
|
m_image.Redraw();
|
|
m_image.SetDC(NULL);
|
|
pImageBox->ReleaseDC(pDC);
|
|
}
|
|
|
|
void ObjView()
|
|
{
|
|
CAcModuleResourceOverride vTemp;
|
|
CViewObjDlg dlg;
|
|
dlg.Create(dlg.IDD, acedGetAcadFrame());
|
|
acedGetAcadDwgView()->SetFocus();
|
|
Entity ent;
|
|
XPoint pt;
|
|
while(ads_entsel(_T("\nÇëÑ¡Ôñ¶ÔÏó: "), ent, pt)==RTNORM) {
|
|
BOOL bOk=FALSE;
|
|
OPENOBJ_BEGIN(ent, AcDb::kForRead, TDbEntity, pEnt);
|
|
if (pEnt) {
|
|
bOk=TRUE;
|
|
dlg.ViewObj(pEnt);
|
|
}
|
|
OPENOBJ_END();
|
|
if (!bOk) {
|
|
OPENOBJ_BEGIN(ent, AcDb::kForRead, TDbCurveEntity, pCurveEnt);
|
|
if (pCurveEnt) {
|
|
dlg.ViewObj(pCurveEnt);
|
|
}
|
|
OPENOBJ_END();
|
|
}
|
|
}
|
|
dlg.DestroyWindow();
|
|
}
|
|
|
|
int CViewObjDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
|
{
|
|
if (CModelessDialog::OnCreate(lpCreateStruct) == -1)
|
|
return -1;
|
|
|
|
// TODO: Add your specialized creation code here
|
|
|
|
return 0;
|
|
}
|