Flask接口签名sign原理与实例代码浅析
298
2022-11-04
绘制连续的直线
1.首先建立MFC单文档工程lessonMyLine3.
2.在其类视图内选择lessonMyLine3View类,在其中添加消息事件“onLButtonUp”、OnLButtonDown、OnMouseMove。
3.完成上述消息内的代码。
// lessonMyLine3View.cpp : implementation of the ClessonMyLine3View class//#include "stdafx.h"// SHARED_HANDLERS can be defined in an ATL project implementing preview, thumbnail// and search filter handlers and allows sharing of document code with that project.#ifndef SHARED_HANDLERS#include "lessonMyLine3.h"#endif#include "lessonMyLine3Doc.h"#include "lessonMyLine3View.h"#ifdef _DEBUG#define new DEBUG_NEW#endif// ClessonMyLine3ViewIMPLEMENT_DYNCREATE(ClessonMyLine3View, CView)BEGIN_MESSAGE_MAP(ClessonMyLine3View, CView) // Standard printing commands ON_COMMAND(ID_FILE_PRINT, &CView::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_DIRECT, &CView::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_PREVIEW, &ClessonMyLine3View::OnFilePrintPreview) ON_WM_CONTEXTMENU() ON_WM_RBUTTONUP() ON_WM_LBUTTONUP() ON_WM_LBUTTONDOWN() ON_WM_MOUSEMOVE()END_MESSAGE_MAP()// ClessonMyLine3View construction/destructionClessonMyLine3View::ClessonMyLine3View() : m_MouseDown(false) , m_point(0){ // TODO: add construction code here}ClessonMyLine3View::~ClessonMyLine3View(){}BOOL ClessonMyLine3View::PreCreateWindow(CREATESTRUCT& cs){ // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CView::PreCreateWindow(cs);}// ClessonMyLine3View drawingvoid ClessonMyLine3View::OnDraw(CDC* /*pDC*/){ ClessonMyLine3Doc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if (!pDoc) return; // TODO: add draw code for native data here}// ClessonMyLine3View printingvoid ClessonMyLine3View::OnFilePrintPreview(){#ifndef SHARED_HANDLERS AFXPrintPreview(this);#endif}BOOL ClessonMyLine3View::OnPreparePrinting(CPrintInfo* pInfo){ // default preparation return DoPreparePrinting(pInfo);}void ClessonMyLine3View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/){ // TODO: add extra initialization before printing}void ClessonMyLine3View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/){ // TODO: add cleanup after printing}void ClessonMyLine3View::OnRButtonUp(UINT /* nFlags */, CPoint point){ ClientToScreen(&point); OnContextMenu(this, point);}void ClessonMyLine3View::OnContextMenu(CWnd* /* pWnd */, CPoint point){#ifndef SHARED_HANDLERS theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EDIT, point.x, point.y, this, TRUE);#endif}// ClessonMyLine3View diagnostics#ifdef _DEBUGvoid ClessonMyLine3View::AssertValid() const{ CView::AssertValid();}void ClessonMyLine3View::Dump(CDumpContext& dc) const{ CView::Dump(dc);}ClessonMyLine3Doc* ClessonMyLine3View::GetDocument() const // non-debug version is inline{ ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(ClessonMyLine3Doc))); return (ClessonMyLine3Doc*)m_pDocument;}#endif //_DEBUG// ClessonMyLine3View message handlersvoid ClessonMyLine3View::OnLButtonUp(UINT nFlags, CPoint point){ // TODO: Add your message handler code here and/or call default m_MouseDown=false; CView::OnLButtonUp(nFlags, point);}void ClessonMyLine3View::OnLButtonDown(UINT nFlags, CPoint point){ // TODO: Add your message handler code here and/or call default m_point=point; m_MouseDown=true; CView::OnLButtonDown(nFlags, point);}void ClessonMyLine3View::OnMouseMove(UINT nFlags, CPoint point){ // TODO: Add your message handler code here and/or call default CClientDC ccdc(this); if(m_MouseDown) { ccdc.MoveTo(m_point); ccdc.LineTo(point); m_point=point; } CView::OnMouseMove(nFlags, point);}
图如下所示“
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~