Chào các bạn! Vì nhiều lý do từ nay Truyen2U chính thức đổi tên là Truyen247.Pro. Mong các bạn tiếp tục ủng hộ truy cập tên miền mới này nhé! Mãi yêu... ♥

veramhinh

/* Ve ra man hinh */

#include<afxwin.h>

class CMyApp:public CWinApp

{

public:

    BOOL InitInstance();

};

CMyApp theApp;

//khai bao lop cua so

class CMyWin:public CFrameWnd

{

    int x1,y1,x2,y2, n;

    public:

       

        CMyWin();

        DECLARE_MESSAGE_MAP();

       

        afx_msg void OnMouseMove( UINT nFlags, CPoint point );

};

//xay dung ham tao cua lop cua so

CMyWin::CMyWin()

{

    //tao ra cua so

    Create(NULL,"Duong");

}

//xay dung ham khoi tao ung dung

BOOL CMyApp::InitInstance()

{

    m_pMainWnd=new CMyWin();//tao ra 1 cua so

    m_pMainWnd->ShowWindow(2);//dat che do hien thi

    m_pMainWnd->UpdateWindow();//ve cua so ra

    return TRUE;

}

BEGIN_MESSAGE_MAP(CMyWin,CFrameWnd)

    ON_WM_MOUSEMOVE()

END_MESSAGE_MAP()

afx_msg void CMyWin::OnMouseMove( UINT nFlags, CPoint point )

{

    int n=0;

    CDC *dc=GetDC();

    PAINTSTRUCT ps;

   

       

   

    if(nFlags == MK_LBUTTON)

    {   

        if(nFlags == MK_LBUTTON)

        {

            y2=y1;

            x2=x1;

        }

        if(nFlags != MK_LBUTTON)

        {

            y2=y1;

            x2=x1;

        }

        x1=point.x;

        y1=point.y;

        dc->MoveTo(x2, y2);       

        dc->LineTo(x1, y1);

    }

    EndPaint(&ps);

}

Bạn đang đọc truyện trên: Truyen247.Pro

Tags: