functionline.cpp
来自「一个简单的画图程序 可以画点线面等」· C++ 代码 · 共 67 行
CPP
67 行
// FunctionLine.cpp: implementation of the CFunctionLine class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "SmallCAD203.h"
#include "FunctionLine.h"
extern CSmallCAD203App theApp;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CFunctionLine::CFunctionLine()
{
m_bIsLButtonDown=FALSE;
ID=1000;
l=NULL;
}
CFunctionLine::~CFunctionLine()
{
}
void CFunctionLine::OnLButtonDown(UINT nFlags, CPoint point)
{
CMainFrame *pFrame=(CMainFrame *)theApp.GetMainWnd();
CSmallCAD203Doc *pDoc=(CSmallCAD203Doc *)pFrame->GetActiveDocument();
CSmallCAD203View *pView=(CSmallCAD203View *)pFrame->GetActiveView();
m_bIsLButtonDown=TRUE;
l=new CGraphLine;
l->SetStartPoint(point);
l->SetEndPoint(point);
l->SetColor(pDoc->GetCurrentColor());
l->SetScale(pDoc->GetCurrentScale());
l->Draw(pView->GetDC());
}
void CFunctionLine::OnLButtonUp(UINT nFlags, CPoint point)
{
CMainFrame *pFrame=(CMainFrame *)theApp.GetMainWnd();
CSmallCAD203Doc *pDoc=(CSmallCAD203Doc *)pFrame->GetActiveDocument();
CSmallCAD203View *pView=(CSmallCAD203View *)pFrame->GetActiveView();
m_bIsLButtonDown=FALSE;
l->SetEndPoint(point);
l->Draw(pView->GetDC());
pDoc->my_list.InSert(l);
//pDoc->AddGraph(l);
}
void CFunctionLine::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();
if(!m_bIsLButtonDown)
return;
pDC->SetROP2(R2_NOTXORPEN);
// CPoint p;
l->Draw(pDC);
l->SetEndPoint(point);
l->Draw(pDC);
// pDoc->AddGraph(l);
pView->ReleaseDC(pDC);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?