⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bsampleview.cpp

📁 附件程序是一个B样条程序的图形文件
💻 CPP
字号:
// BSampleView.cpp : implementation of the CBSampleView class
//

#include "stdafx.h"
#include "BSample.h"

#include "BSampleDoc.h"
#include "BSampleView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CBSampleView

IMPLEMENT_DYNCREATE(CBSampleView, CFODrawView)
BEGIN_MESSAGE_MAP(CBSampleView,CFODrawView)
	//{{AFX_MSG_MAP(CBSampleView)
	ON_COMMAND(ID_DRAW_CB1, OnDrawCb1)
	ON_UPDATE_COMMAND_UI(ID_DRAW_CB1, OnUpdateDrawCb1)
	ON_COMMAND(ID_DRAW_CB2, OnDrawCb2)
	ON_UPDATE_COMMAND_UI(ID_DRAW_CB2, OnUpdateDrawCb2)
	ON_COMMAND(ID_DRAW_CB3, OnDrawCb3)
	ON_UPDATE_COMMAND_UI(ID_DRAW_CB3, OnUpdateDrawCb3)
	//}}AFX_MSG_MAP
	ON_COMMAND(ID_FILE_PRINT, CFODrawView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CFODrawView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CFODrawView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CBSampleView construction/destruction

CBSampleView::CBSampleView()
{
	// TODO: add construction code here
	m_bCenter = FALSE;
}

CBSampleView::~CBSampleView()
{
}

BOOL CBSampleView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREAFOAPPWIZARDRUCT cs
	return CFODrawView::PreCreateWindow(cs);

}

/////////////////////////////////////////////////////////////////////////////
// CBSampleView drawing

void CBSampleView::OnDraw(CDC* pDC)
{
	CBSampleDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	Draw(pDC);
	// TODO: add draw code for native data here
}

void CBSampleView::OnInitialUpdate()
{
	SetCurrentModel(GetDocument()->m_pDataModel);
	CFODrawView::OnInitialUpdate();
	CRect rcPos;
	rcPos = CRect(0,0,2000,2000);
	GetCurrentModel()->SetPagePosition(rcPos);
	GetCurrentModel()->SetLockWithPages(FALSE);
	CFOFormProperties *pProp = GetCurrentModel()->GetDefaultProperty();
	pProp->ShowMargin(FALSE);
	GetCurrentModel()->SetAllowHoleLink(TRUE);
	UpdateScrollSize();

}

/////////////////////////////////////////////////////////////////////////////
// CBSampleView printing

BOOL CBSampleView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return CFODrawView::OnPreparePrinting(pInfo);
}

void CBSampleView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
{
	// TODO: add extra initialization before printing
	// XD++ Library Add line.
	CFODrawView::OnBeginPrinting(pDC,pInfo);
}

void CBSampleView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CBSampleView diagnostics

#ifdef _DEBUG
void CBSampleView::AssertValid() const
{
//XD++ Library add lines.
	CFODrawView::AssertValid();


	//CView::AssertValid();
}

void CBSampleView::Dump(CDumpContext& dc) const
{
//XD++ Library add lines.
	CFODrawView::Dump(dc);


	//CView::Dump(dc);
}

CBSampleDoc* CBSampleView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CBSampleDoc)));
	return (CBSampleDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CBSampleView message handlers
//XD++ Library add line.
void CBSampleView::OnPrint(CDC* pDC, CPrintInfo* pInfo) 
{
	// TODO: Add your specialized code here and/or call the base class
	
	CFODrawView::OnPrint(pDC, pInfo);
}


void CBSampleView::OnDrawCb1() 
{
	// TODO: Add your command handler code here
	if(m_drawshape == FO_COMP_COMPOSITE && m_nCurShapeResID == IDR_CB1)
	{
		m_action_state = State_SelectNone;
		m_drawshape = FO_COMP_NONE;
		FOSetSystemCursor(IDC_ARROW);
		return;
	}
	StartCustomShapeID(IDR_CB1);
	AddShapePort(0.5,0.0);
	AddShapePort(0.5,1.0);
}

void CBSampleView::OnUpdateDrawCb1(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	BOOL bDesign = GetCurrentModel()->IsDesignMode();
	pCmdUI->Enable(bDesign);

	pCmdUI->SetCheck(m_drawshape == FO_COMP_COMPOSITE && m_nCurShapeResID == IDR_CB1);

}

void CBSampleView::OnDrawCb2() 
{
	// TODO: Add your command handler code here
	if(m_drawshape == FO_COMP_COMPOSITE && m_nCurShapeResID == IDR_CB2)
	{
		m_action_state = State_SelectNone;
		m_drawshape = FO_COMP_NONE;
		FOSetSystemCursor(IDC_ARROW);
		return;
	}
	StartCustomShapeID(IDR_CB2);
	AddShapePort(0.0,0.4);
	AddShapePort(1.0,0.4);
}

void CBSampleView::OnUpdateDrawCb2(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	BOOL bDesign = GetCurrentModel()->IsDesignMode();
	pCmdUI->Enable(bDesign);

	pCmdUI->SetCheck(m_drawshape == FO_COMP_COMPOSITE && m_nCurShapeResID == IDR_CB2);

}

void CBSampleView::OnDrawCb3() 
{
	// TODO: Add your command handler code here
	if(m_drawshape == FO_COMP_COMPOSITE && m_nCurShapeResID == IDR_CB3)
	{
		m_action_state = State_SelectNone;
		m_drawshape = FO_COMP_NONE;
		FOSetSystemCursor(IDC_ARROW);
		return;
	}
	StartCustomShapeID(IDR_CB3);
	AddShapePort(0.5,0.0);
	AddShapePort(0.5,1.0);
}

void CBSampleView::OnUpdateDrawCb3(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	BOOL bDesign = GetCurrentModel()->IsDesignMode();
	pCmdUI->Enable(bDesign);

	pCmdUI->SetCheck(m_drawshape == FO_COMP_COMPOSITE && m_nCurShapeResID == IDR_CB3);

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -