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

📄 rect.h

📁 实时监控
💻 H
字号:
/*!	\mainpage CRect 辅助功能
 *	\author nodman
 *	\date	2003-6-11
 */

#ifndef _RECT_H
#define _RECT_H

#include "utils.h"

/// 取得窗口的客户区域
class client_rect: public CRect
{
public:
	/// 构造函数
	/// @param owner 要取得哪一个窗口的client rect
	client_rect(CWnd *owner)
	{
		/// @see utils.h #is_window()
		if( !is_window(owner) )
			return;
		owner->GetClientRect(this);
	}
};

/// 取得窗口区域
class window_rect: public CRect
{
public:
	/// 构造函数
	/// @param owner 要取得哪一个窗口的window rect
	window_rect(CWnd *owner)
	{
		if( !is_window(owner) )
			return;

		owner->GetWindowRect(this);
	}
};

static void vcenter_rect(CRect& host, CRect& client)
{
	int h = client.Height();
	client.top = host.top + (host.Height()-client.Height())/2;
	client.bottom = client.top + h;
}

static void hcenter_rect(CRect& host, CRect& client)
{
	int w = client.Width();
	client.left = host.left + (host.Width()-client.Width())/2;
	client.right = client.left + w;
}

static void center_rect(CRect& host, CRect& client)
{
	hcenter_rect(host, client);
	vcenter_rect(host, client);
}

#endif	//	_RECT_H

⌨️ 快捷键说明

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