📄 functionrectangle.cpp
字号:
// FunctionRectangle.cpp: implementation of the CFunctionRectangle class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "FunctionRectangle.h"
#include "FunctionPolygon.h"
#include "MainFrm.h"
#include "SmallCAD203.h"
#include "SmallCAD203Doc.h"
#include "SmallCAD203View.h"
extern CSmallCAD203App theApp;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CFunctionRectangle::CFunctionRectangle()
{
l=NULL;
mouseD=FALSE;
ID=1;
}
CFunctionRectangle::~CFunctionRectangle()
{
}
void CFunctionRectangle::OnLButtonDown(UINT nFlags, CPoint point)
{
CMainFrame *pFrame=(CMainFrame *)theApp.GetMainWnd();
CSmallCAD203Doc *pDoc=(CSmallCAD203Doc *)pFrame->GetActiveDocument();
CSmallCAD203View *pView=(CSmallCAD203View *)pFrame->GetActiveView();
mouseD=TRUE;
l=new CGraphRectangle;
l->SetColor(pDoc->GetCurrentColor());
l->SetScale(pDoc->GetCurrentScale());
CDC *pDC=pView->GetDC();
l->SetPoint1(point);
l->SetPoint2(point);
l->Draw(pView->GetDC());
pView->ReleaseDC(pDC);
}
void CFunctionRectangle::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->SetPoint2(point);
l->Draw(pView->GetDC());
//pDoc->AddGraph(l);
pDoc->my_list.InSert(l);
pView->ReleaseDC(pDC);
}
void CFunctionRectangle::OnMouseMove(UINT nFlags, CPoint point)
{
CMainFrame *pFrame=(CMainFrame *)theApp.GetMainWnd();
CSmallCAD203Doc *pDoc=(CSmallCAD203Doc *)pFrame->GetActiveDocument();
CSmallCAD203View *pView=(CSmallCAD203View *)pFrame->GetActiveView();
CDC *pDC=pView->GetDC();
// pDC->SetROP2(R2_NOTXORPEN);
if(!mouseD)
return;
pDC->SetROP2(R2_NOTXORPEN);
l->Draw(pDC);
l->SetPoint2(point);
l->Draw(pDC);
pView->ReleaseDC(pDC);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -