📄 functiontriangle.cpp
字号:
// FunctionTriangle.cpp: implementation of the CFunctionTriangle class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "smallcad203.h"
#include "FunctionTriangle.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
//////////////////////////////////////////////////////////////////////
CFunctionTriangle::CFunctionTriangle()
{
b=0;
// point1.x=point2.x=point3.x=3;
l=NULL;
mouseD=FALSE;
}
CFunctionTriangle::~CFunctionTriangle()
{
}
void CFunctionTriangle::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();
b++;
if(b==1)
{
l=new CGraphTriangle;
l->SetColor(pDoc->GetCurrentColor());
l->SetScale(pDoc->GetCurrentScale());
l->SetPoint1(point);
}
if(b==2)
{
l->SetPoint2(point);
l->Draw(pDC);
}
if(b==3)
{
l->SetPoint3(point);
l->Draw(pDC);
b=0;
pDoc->my_list.InSert(l);
}
pView->ReleaseDC(pDC);
}
void CFunctionTriangle::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;
if(b == 2)
pDoc->AddGraph(l);
}
void CFunctionTriangle::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;
pView->ReleaseDC(pDC);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -