📄 functionpolygon.cpp
字号:
// FunctionPolygon.cpp: implementation of the CFunctionPolygon class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "smallcad203.h"
#include "FunctionPolygon.h"
#include "MainFrm.h"
#include "SmallCAD203Doc.h"
#include "SmallCAD203View.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
extern CSmallCAD203App theApp;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CFunctionPolygon::CFunctionPolygon()
{
a=0;
l=NULL;
mouseD=FALSE;
}
CFunctionPolygon::~CFunctionPolygon()
{
}
void CFunctionPolygon::OnLButtonDown(UINT nFlags, CPoint point)
{
CMainFrame *pFrame=(CMainFrame *)theApp.GetMainWnd();
CSmallCAD203Doc *pDoc=(CSmallCAD203Doc *)pFrame->GetActiveDocument();
CSmallCAD203View *pView=(CSmallCAD203View *)pFrame->GetActiveView();
mouseD=TRUE;
CDC *pDC=pView->GetDC();
a++;
if(a==1)
{
l=new CGraphLine;
l->SetStartPoint(point);
l->SetEndPoint(point);
l->SetColor(pDoc->GetCurrentColor());
l->SetScale(pDoc->GetCurrentScale());
}
pView->ReleaseDC(pDC);
}
void CFunctionPolygon::OnLButtonUp(UINT nFlags, CPoint point)
{
CMainFrame *pFrame=(CMainFrame *)theApp.GetMainWnd();
CSmallCAD203Doc *pDoc=(CSmallCAD203Doc *)pFrame->GetActiveDocument();
CSmallCAD203View *pView=(CSmallCAD203View *)pFrame->GetActiveView();
CDC *pDC=pView->GetDC();
mouseD = FALSE;
l->SetEndPoint(point);
l->Draw(pView->GetDC());
// pDoc->my_list.InSert(l);
// pDoc->AddGraph(l);
l->SetStartPoint(point);
pView->ReleaseDC(pDC);
}
void CFunctionPolygon::OnMouseMove(UINT nFlags, CPoint point)
{
CMainFrame *pFrame=(CMainFrame *)theApp.GetMainWnd();
CSmallCAD203Doc *pDoc=(CSmallCAD203Doc *)pFrame->GetActiveDocument();
CSmallCAD203View *pView=(CSmallCAD203View *)pFrame->GetActiveView();
CDC *pDC=pView->GetDC();
if(!mouseD)
return;
pDC->SetROP2(R2_NOTXORPEN);
l->Draw(pDC);
l->SetEndPoint(point);
l->Draw(pDC);
// pDoc->AddGraph(l);
pView->ReleaseDC(pDC);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -