在继承自CAcroAXDocShim的类中处理OnMouseWheel

时间:2017-03-02 09:42:43

标签: c++ mfc

我使用的是MFC,我有一个可停靠的窗格来查看PDF文件。 我创建了一个名为CCL2AcroAXDocShim的类,并使其继承自CAcroAXDocShim,我尝试实现函数OnMouseWheel以保存PDF关闭时使用的当前缩放级别并再次打开,但它根本没有开火。

//the header file
#include "AcroAXDocShim.h"

class CCL2AcroAXDocShim : public CAcroAXDocShim
{
public:

  /**
  * Default constructor.
  */
  CCL2AcroAXDocShim();
  /**
  * Destructor.
  */
  virtual ~CCL2AcroAXDocShim();

protected:
  DECLARE_DYNCREATE(CCL2AcroAXDocShim)

  afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); 
  //}}AFX_MSG
  DECLARE_MESSAGE_MAP()

private:
  struct CCL2AcroAXDocShimMembers *m_pMembers;
};

//the CPP file
IMPLEMENT_DYNCREATE(CCL2AcroAXDocShim, CAcroAXDocShim)

BEGIN_MESSAGE_MAP(CCL2AcroAXDocShim, CAcroAXDocShim)
//{{AFX_MSG_MAP(CCL2PDFSchematicsPage)
ON_WM_MOUSEWHEEL()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

// Default constructor
CCL2AcroAXDocShim::CCL2AcroAXDocShim()
{
  m_pMembers = new CCL2AcroAXDocShimMembers;
}

// Destructor
CCL2AcroAXDocShim::~CCL2AcroAXDocShim()
{
  if (m_pMembers)
    delete m_pMembers;
}

BOOL CCL2AcroAXDocShim::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
{
  if(nFlags & (MK_CONTROL))
  {
    m_pMembers->m_OldMouseWheel.pt = pt;
    m_pMembers->m_OldMouseWheel.nFlags = nFlags;
    m_pMembers->m_OldMouseWheel.zDelta += zDelta;
  }

  return CAcroAXDocShim::OnMouseWheel(nFlags, zDelta, pt);
}

并且班级CAcroAXDocShim继承自CWnd,其中包含方法OnMouseWheel 如何才能调用函数OnMouseWheel?或者是否有其他方法可以在CCL2AcroAXDocShim课程中查看当前缩放级别? 提前致谢

0 个答案:

没有答案