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);

    }

  • 相关阅读:
    面试题目
    MyEclipse 启动 tomcat时错误处理
    js 剪贴板操作
    PHP面试题
    MySQL 数据库 source 导入乱码
    php 不用通过表单也能创建HTTPpost请求
    一个css中zindex的用法
    最新黑链代码expression:隐藏链接代码
    测试网站访问速度的几个小方法
    优秀开源外贸网店程序一览
  • 原文地址:https://www.cnblogs.com/meiproject/p/1497101.html
Copyright © 2011-2022 走看看