📄 techdemand.cpp
字号:
#include "stdafx.h"
#include "resourcehelper.h"
#include <dbsymtb.h>
#include <geassign.h>
#include <adslib.h>
#include <rxregsvc.h>
#include <aced.h>
#include <rxobject.h>
#include <dbents.h>
#include <adsdlg.h>
#include <adscodes.h>
#include <dbmtext.h>
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
extern "C" HWND adsw_acadMainWnd();
void TechDemand(){
CTemporaryResourceOverride thisResource;
CTechDemandDialog TechDemandDialog(CWnd::FromHandle(adsw_acadMainWnd()));
TechDemandDialog.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CTechDemandDialog dialog
CTechDemandDialog::CTechDemandDialog(CWnd* pParent /*=NULL*/)
: CDialog(CTechDemandDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CTechDemandDialog)
//}}AFX_DATA_INIT
}
void CTechDemandDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTechDemandDialog)
DDX_Control(pDX, IDC_RICHEDIT_TechDemand, m_ctrlEDITTechDemand);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTechDemandDialog, CDialog)
//{{AFX_MSG_MAP(CTechDemandDialog)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTechDemandDialog message handlers
BOOL CTechDemandDialog::SearchTechDemand(CString TechDemandText){
AcDbTextStyleTable *pStyleTable;
AcDbTextStyleTableIterator *pIterator;
AcDbObjectId styleId,objId;;
AcDbBlockTableRecord *pBlock;
AcDbBlockTable *pBlockTable;
AcGePoint3d techdemandpoint(360,140,0);
acdbCurDwg()->getTextStyleTable(pStyleTable,
AcDb::kForRead);
pStyleTable->newIterator(pIterator);
pIterator->getRecordId(styleId);
delete pIterator;
pStyleTable->close();
AcDbMText *ptechdemand=new AcDbMText();
ptechdemand->setLocation(techdemandpoint);
ptechdemand->setContents(TechDemandText);
ptechdemand->setTextStyle(styleId);
ptechdemand->setTextHeight(4.0);
acdbCurDwg()->getBlockTable(pBlockTable,
AcDb::kForRead);
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlock,
AcDb::kForWrite);
pBlock->appendAcDbEntity(objId, ptechdemand);
pBlockTable->close();
pBlock->close();
ptechdemand->close();
return TRUE;
}
void CTechDemandDialog::OnOK()
{
// TODO: Add extra validation here
CString techdemandtext;
m_ctrlEDITTechDemand.GetWindowText(techdemandtext);
SearchTechDemand(techdemandtext);
CDialog::OnOK();
}
void CTechDemandDialog::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
BOOL CTechDemandDialog::OnInitDialog()
{
CString title,techdemandtext;
CDialog::OnInitDialog();
// TODO: Add extra initialization here
title.LoadString(IDS_STRING_Title);
techdemandtext.LoadString(IDS_STRING_TechDemand);
SetWindowText(title);
m_ctrlEDITTechDemand.SetWindowText(techdemandtext);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -