我想写一个画曲线图的类。
1.能画出xy轴坐标。
2.鼠标放在曲线上能显示出xy轴的数据。这个类我想从CWin类继承下来,可是不知道怎么写,恳请各位大侠给我提示,分不够再加。
1.这个类怎么实现自绘功能,比如我在外部设定xy轴的最大最小值,怎么把xy轴坐标画出来。
2.怎么响应鼠标移动这个消息,比如我鼠标在曲线图上移动的时候,鼠标显示一个浮动窗口,显示xy轴数据。

解决方案 »

  1.   

    应该是CWnd吧
    画出xy坐标,可以响应WM_PAINT的消息,使用DC来画
    鼠标移动,可以在WM_MOUSEMOVE消息中得到相关数据,而显示浮动窗口,则可以用tooltip来实现
      

  2.   

    噢,是CWnd,谢谢空谷清音纠正。
      

  3.   

    to flyelf(空谷清音):
    能不能给我一个简单的从CWnd类继承的例子。
    比如就在窗口上画个圆圈。
      

  4.   

    TestWnd.h:class CTestWnd : public CWnd
    {
    // Construction
    public:
    CTestWnd();// Attributes
    public:// Operations
    public:// Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CTestWnd)
    //}}AFX_VIRTUAL// Implementation
    public:
    virtual ~CTestWnd(); // Generated message map functions
    protected:
    //{{AFX_MSG(CTestWnd)
    afx_msg void OnPaint();
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
    };TestWnd.cpp:// TestWnd.cpp : implementation file
    //#include "stdafx.h"
    #include "test.h"
    #include "TestWnd.h"#ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif/////////////////////////////////////////////////////////////////////////////
    // CTestWndCTestWnd::CTestWnd()
    {
    }CTestWnd::~CTestWnd()
    {
    }
    BEGIN_MESSAGE_MAP(CTestWnd, CWnd)
    //{{AFX_MSG_MAP(CTestWnd)
    ON_WM_PAINT()
    //}}AFX_MSG_MAP
    END_MESSAGE_MAP()
    /////////////////////////////////////////////////////////////////////////////
    // CTestWnd message handlersvoid CTestWnd::OnPaint() 
    {
    CPaintDC dc(this); // device context for painting

    // TODO: Add your message handler code here
    CRect rcClient;
    GetClientRect(rcClient); dc.Ellipse(rcClient);
    // Do not call CWnd::OnPaint() for painting messages
    }
      

  5.   

    你需要继承CFramWnd吧
    http://www.fixdown.com/article/article/1070.htm