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

📄 magdialog.h

📁 MagTest 类似winamp磁性窗口
💻 H
字号:
////////////////////////////////////////////////////////////////////////////////////////
//	CMagDialog
//
//	A "magnetic" class derived from CDialog
//  this class enable dialogs to dock side by side
//
//  This code may be used in compiled form in any way you desire. This file may be
//  redistributed unmodified by any means PROVIDING it is not sold for profit without
//  the authors written consent, and providing that this notice and the authors name 
//  is included. If the source code in  this file is used in any commercial application 
//  then acknowledgement must be made to the author of this file .
//
//  This file is provided "as is" with no expressed or implied warranty.
// 
//  written by Francesco Aruta (a.francesco@mclink.it) 
//  http://www.ilpanda.com 
// 
////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <vector>


class CMagDialog : public CDialog
{
	struct dk_window 
	{
		CMagDialog*	pWnd;
		BOOL		bDocked;
		DWORD		nEdge;
		DWORD		dwMagType;
		int			delta;
	};

	CMagDialog*	m_pMagParentDlg;
	DWORD		m_dwMagType;
	DWORD		nEdge;
	BOOL		m_bDocked;
	BOOL		m_bDisablePosFix;
	int			m_iDelta;

	std::vector <dk_window> m_dkDialogs;
	DECLARE_DYNAMIC(CMagDialog)

public:
	CMagDialog(UINT nIDTemplate,CWnd* pParent = NULL);

	virtual ~CMagDialog();

	enum	{	DKDLG_NONE	 = 0,
				DKDLG_ANY	 = 1,
				DKDLG_LEFT	 = 2,
				DKDLG_RIGHT	 = 4,
				DKDLG_TOP	 = 8,
				DKDLG_BOTTOM = 16
			};

protected:
	afx_msg void OnMoving(UINT fwSide, LPRECT pRect);
	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
	afx_msg void OnWindowPosChanging(WINDOWPOS* lpwndpos);
	virtual void DoDataExchange(CDataExchange* pDX);    // Supporto DDX/DDV

	DECLARE_MESSAGE_MAP()

private:
	void UnDockMagneticDialog(CMagDialog* pDialog);
	void DockMagneticDialog(CMagDialog* pDialog,DWORD nEdge);
	void UpdateMagPosition(CMagDialog* pDialog);
	void MoveMagDialog(LPCRECT lpRect, BOOL bRepaint, BOOL bDisablePosFix);
	void UpdateDockData(dk_window dkdata);

public:
	void EnableMagnetic(DWORD dwMagType,CMagDialog* pMagParentDlg);
	void AddMagneticDialog(CMagDialog* pDialog,BOOL bDocked = FALSE,DWORD dwMagWhere =0);
	

};

⌨️ 快捷键说明

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