📄 functionhandline.cpp
字号:
// FunctionHandLine.cpp: implementation of the CFunctionHandLine class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "SmallCAD203.h"
#include "FunctionHandLine.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
//////////////////////////////////////////////////////////////////////
CFunctionHandLine::CFunctionHandLine()
{
l=NULL;
bIsLButtonDown=FALSE;
}
CFunctionHandLine::~CFunctionHandLine()
{
}
void CFunctionHandLine::OnLButtonDown(UINT nFlags, CPoint point)
{
// startPoint=point;
// endPoint=point;
CMainFrame *pFrame=(CMainFrame *)theApp.GetMainWnd();
CSmallCAD203Doc *pDoc=(CSmallCAD203Doc *)pFrame->GetActiveDocument();
CSmallCAD203View *pView=(CSmallCAD203View *)pFrame->GetActiveView();
bIsLButtonDown=TRUE;
CDC *pDC=pView->GetDC();
l=new CGraphLine;
l->SetStartPoint(point);
l->SetEndPoint(point);
l->SetColor(pDoc->GetCurrentColor());
l->SetScale(pDoc->GetCurrentScale());
l->Draw(pDC);
pView->ReleaseDC(pDC);
}
void CFunctionHandLine::OnLButtonUp(UINT nFlags, CPoint point)
{
CMainFrame *pFrame=(CMainFrame *)theApp.GetMainWnd();
CSmallCAD203Doc *pDoc=(CSmallCAD203Doc *)pFrame->GetActiveDocument();
CSmallCAD203View *pView=(CSmallCAD203View *)pFrame->GetActiveView();
CDC *pDC=pView->GetDC();
bIsLButtonDown = FALSE;
l->SetEndPoint(point);
l->Draw(pDC);
pDoc->my_list.InSert(l);
//pDoc->AddGraph(l);
pView->ReleaseDC(pDC);
}
void CFunctionHandLine::OnMouseMove(UINT nFlags, CPoint point)
{
CMainFrame *pFrame=(CMainFrame *)theApp.GetMainWnd();
CSmallCAD203Doc *pDoc=(CSmallCAD203Doc *)pFrame->GetActiveDocument();
CSmallCAD203View *pView=(CSmallCAD203View *)pFrame->GetActiveView();
// bIsLButtonDown=FALSE;
CDC *pDC=pView->GetDC();
// pDC->SetROP2(R2_NOTXORPEN);
// CPoint p;
// l->Draw(pDC);
if(!bIsLButtonDown)
return;
l->SetEndPoint(point);
l->Draw(pDC);
l->SetStartPoint(point);
//pDoc->AddGraph(l);
pView->ReleaseDC(pDC);
}
void CFunctionHandLine::Draw()
{
// CPen pen;
// pen.CreatePen(PS_SOLID,m_scale,m_color);
// pDC->SelectObject(&pen);
// pDC->MoveTo(startPoint);
// pDC->LineTo(endPoint);
// startPoint=endPoint;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -