📄 enginecontrolsdlg.h
字号:
/*
Copyright 1995-2004 ESRI
All rights reserved under the copyright laws of the United States.
You may freely redistribute and use this sample code, with or without modification.
Disclaimer: THE SAMPLE CODE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ESRI OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) SUSTAINED BY YOU OR A THIRD PARTY, HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ARISING IN ANY
WAY OUT OF THE USE OF THIS SAMPLE CODE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
For additional information contact: Environmental Systems Research Institute, Inc.
Attn: Contracts Dept.
380 New York Street
Redlands, California, U.S.A. 92373
Email: contracts@esri.com
*/
#ifndef __MYDIALOG_H_
#define __MYDIALOG_H_
#include "resource.h"
// Type information for the event handlers
extern _ATL_FUNC_INFO OnAfterDrawInfo;
extern _ATL_FUNC_INFO OnMouseDownInfo;
extern _ATL_FUNC_INFO OnPageLayoutReplacedInfo;
extern _ATL_FUNC_INFO OnEndLabelEditInfo;
// This dialog needs to be a COM object to be able to act as a listener for events
// from the CustomizeDialog and the DisplayTransformation
class CEngineControlsDlg :
public CAxDialogImpl<CEngineControlsDlg>,
public CComObjectRoot,
public IDispEventSimpleImpl<IDC_MAPCONTROL, CEngineControlsDlg, &DIID_IMapControlEvents2>,
public IDispEventSimpleImpl<IDC_PAGELAYOUTCONTROL, CEngineControlsDlg, &DIID_IPageLayoutControlEvents>,
public IDispEventSimpleImpl<IDC_TOCCONTROL, CEngineControlsDlg, &DIID_ITOCControlEvents>,
public ICustomizeDialogEvents,
public ITransformEvents
{
public:
enum { IDD = IDD_DIALOG_DOCPROPS };
CEngineControlsDlg() : m_dwCustDlgCookie(0), m_dwDisplayCookie(0) {}
BEGIN_MSG_MAP(CEngineControlsDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_SIZE, OnSize)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
COMMAND_ID_HANDLER(IDCANCEL, OnClose)
COMMAND_HANDLER(IDC_CHECK_CUSTOMIZE, BN_CLICKED, OnCheckedCustomize)
END_MSG_MAP()
// The SinkMap is used to listen to IDispatch based events from the controls. It cannot be
// used for pure COM event interfaces
BEGIN_SINK_MAP(CEngineControlsDlg)
SINK_ENTRY_INFO(IDC_MAPCONTROL, DIID_IMapControlEvents2, 0x9, OnAfterDraw, &OnAfterDrawInfo)
SINK_ENTRY_INFO(IDC_PAGELAYOUTCONTROL, DIID_IPageLayoutControlEvents, 0x1, OnMouseDown, &OnMouseDownInfo)
SINK_ENTRY_INFO(IDC_PAGELAYOUTCONTROL, DIID_IPageLayoutControlEvents, 0xE, OnPageLayoutReplaced, &OnPageLayoutReplacedInfo)
SINK_ENTRY_INFO(IDC_TOCCONTROL, DIID_ITOCControlEvents, 0x8, OnEndLabelEdit, &OnEndLabelEditInfo)
END_SINK_MAP()
// These two interfaces are not Dispatch based so we need to implement them directly on
// the dialog
BEGIN_COM_MAP(CEngineControlsDlg)
COM_INTERFACE_ENTRY(ICustomizeDialogEvents)
COM_INTERFACE_ENTRY(ITransformEvents)
END_COM_MAP()
// Message handlers
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnClose(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnCheckedCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
// Event handlers
HRESULT __stdcall OnAfterDraw(VARIANT display, long viewDrawPhase);
HRESULT __stdcall OnMouseDown(long button, long shift, long x, long y, double pageX, double pageY);
HRESULT __stdcall OnPageLayoutReplaced(VARIANT newMap);
HRESULT __stdcall OnEndLabelEdit(long x, long y, BSTR newLabel, VARIANT_BOOL *CanEdit);
// ICustomizeDialogEvents
STDMETHOD(OnStartDialog)();
STDMETHOD(OnCloseDialog)();
// ITransformEvents
STDMETHOD(BoundsUpdated)(IDisplayTransformation *sender);
STDMETHOD(VisibleBoundsUpdated)(IDisplayTransformation *sender, VARIANT_BOOL sizeChanged);
STDMETHOD(DeviceFrameUpdated)(IDisplayTransformation *sender, VARIANT_BOOL sizeChanged);
STDMETHOD(ResolutionUpdated)(IDisplayTransformation *sender);
STDMETHOD(RotationUpdated)(IDisplayTransformation *sender);
STDMETHOD(UnitsUpdated)(IDisplayTransformation *sender);
private:
void CreateToolbarItems();
void CreateCustomizeDialog();
void CreateOverviewSymbol();
void GetCurrentDir(CComBSTR &bstrDirName);
IToolbarMenuPtr m_ipToolbarMenu; // The popup menu
IEnvelopePtr m_ipEnvelope; // The envelope drawn on the MapControl
ISimpleFillSymbolPtr m_ipFillSymbol; // The symbol used to draw the envelope on the MapControl
ICustomizeDialogPtr m_ipCustomizeDialog; // The customize dialog used by the ToolbarControl
DWORD m_dwCustDlgCookie; // Cookie for CustomizeDialogEvents
DWORD m_dwDisplayCookie; // Cookie for DisplayEvents
// The Controls
IToolbarControlPtr m_ipToolbarControl;
ITOCControlPtr m_ipTOCControl;
IMapControl3Ptr m_ipMapControl;
IPageLayoutControl2Ptr m_ipPageLayoutControl;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -