⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 maptoolbase.h

📁 在vc环境下
💻 H
字号:
// MapToolBase.h: interface for the CMapToolBase class.
//
//////////////////////////////////////////////////////////////////////
#pragma once
#include "MapCommandBase.h"

// 
// Provides basic implementation of a tool that requires a focus map 
// This inherits ICommand from CMapCommandBase
// Inherit this into your tool implementation
//
// Default behaviour
//   Cursor - returns normal cursor or mouse down cursor
//   Deactivate - returns true;
//   MouseDown, MouseUp, MouseMove - implementation is required.
//   other functions return S_OK
//
// Use the mouse helper functions in your implementations of OnMouseDown, OnMouseUp
// MouseDown will try and set the focus map (in PageLayout) if successful:
//   sets MouseCapure - mouse move goes to window even if pointer is outside the window)
//   Switches cursor
//   Sets IsMouseDown state to true.
// MouseUp will reset the state from MouseDown
//
// Constructor takes resource ids
//
class CMapToolBase : public CMapCommandBase,
					 public ITool
{
public:
	CMapToolBase(WORD bitmapID = NULL,
            UINT caption = 0,
            UINT category = 0,
            UINT tooltip = 0,
            UINT message = 0,
            UINT helpfile = 0,
            LONG helpID = 0,
            UINT cursorID = 0,
            UINT cursorMoveID = 0);

	virtual ~CMapToolBase();

// ITool
public:  
  STDMETHOD(get_Cursor)(OLE_HANDLE * Cursor);
  STDMETHOD(OnMouseDown)(LONG Button, LONG Shift, LONG X, LONG Y) = 0;
  STDMETHOD(OnMouseMove)(LONG Button, LONG Shift, LONG X, LONG Y) = 0;
  STDMETHOD(OnMouseUp)(LONG Button, LONG Shift, LONG X, LONG Y) = 0;
  STDMETHOD(OnDblClick)();
  STDMETHOD(OnKeyDown)(LONG keyCode, LONG Shift);
  STDMETHOD(OnKeyUp)(LONG keyCode, LONG Shift);
  STDMETHOD(OnContextMenu)(LONG X, LONG Y, VARIANT_BOOL * handled);
  STDMETHOD(Refresh)(OLE_HANDLE hDC);
  STDMETHOD(Deactivate)(VARIANT_BOOL * complete);

//Helper functions 
protected:  
  HRESULT SetFocusMap(LONG X, LONG Y); // Use this to switch the focus map on a pagelayout 
  bool MouseDown(LONG X, LONG Y);      // Sets focus map (if possible) and Starts mouse capture
  void MouseUp();                      // Finishes mouse capture
  bool IsMouseDown() { return m_bMouseDown; }

private:
  HCURSOR         m_hCursor;
  HCURSOR         m_hCursorMove;
  bool            m_bMouseDown;
};


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -