zoukankan      html  css  js  c++  java
  • vc画线

    private:
     CPoint m_ptOrigin;

    CPtestView::CPtestView()
    {
     // TODO: add construction code here
        m_ptOrigin=0;
    }

    void CPtestView::OnLButtonDown(UINT nFlags, CPoint point)
    {
     // TODO: Add your message handler code here and/or call default
    // MessageBox("view clicked");
     m_ptOrigin=point;
     CView::OnLButtonDown(nFlags, point);
    }

    void CPtestView::OnLButtonUp(UINT nFlags, CPoint point)
    {

     // TODO: Add your message handler code here and/or call default
     //画线1
     
     /*HDC hdc;
     hdc=::GetDC(m_hWnd);
     MoveToEx(hdc,m_ptOrigin.x,m_ptOrigin.y,NULL);
     LineTo(hdc,point.x,point.y);
        ::ReleaseDC(m_hWnd,hdc);
        */

     //画线2
     /*
     CDC *pDc=GetDC();
        pDc->MoveTo(m_ptOrigin);
     pDc->LineTo(point);
        ReleaseDC(pDc);
        */

     //画线3
        /*
     CClientDC dc(this);//dc(GetParent());
     dc.MoveTo(m_ptOrigin);
     dc.LineTo(point);
        */
     /*
     //画线4
     //CWindowDC  dc(this);//本View的指针地址
     //CWindowDC  dc(GetParent());//父框架的指针地址
     CWindowDC  dc(GetDesktopWindow());//GetDesktopWindow();桌面得指针地址
     dc.MoveTo(m_ptOrigin);
     dc.LineTo(point);
        */

        //画线5
     /*
     CPen pen(PS_SOLID,10,RGB(255,0,0));
        CClientDC dc(this);
     CPen *pOldPen=dc.SelectObject(&pen);
     dc.MoveTo(m_ptOrigin);
     dc.LineTo(point);
     dc.SelectObject(pOldPen);
        */
     CView::OnLButtonUp(nFlags, point);

    }

  • 相关阅读:
    20180404
    20180323
    20180315
    mongodb
    linux 集群 读写分离 session入库 负载均衡 配置
    linux 搭建配置 lnmp搭建
    有语义标签
    CSS标签属性
    使用QQ登录商城
    ajax 跨域
  • 原文地址:https://www.cnblogs.com/meiproject/p/1497101.html
Copyright © 2011-2022 走看看