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

📄 wndplace.h

📁 实时监控
💻 H
字号:
/*!	处理CWnd派生类的位置
 *	\mainpage 窗口尺寸处理
 *	\author nodman
 *	\date	2003-6-12
 */

#ifndef _WNDPLACE_H
#define _WNDPLACE_H

#include "utils.h"
#include "rect.h"

#define CHECK_VALID if( !is_window(this) ) return;

/// 改变窗口大小
template<typename wnd>
class wnd_place: public wnd
{
public:
	/// @name 构造函数
	//@{
	/// 针对CDialog(UINT, CWnd*)
	wnd_place(UINT idd, CWnd* parent=NULL):wnd(idd, parent){}
	//@}
	
	/// 设置窗口大小
	/// @param w 宽度
	/// @param h 高度
	void set_size(int w, int h)
	{
		CHECK_VALID;
		SetWindowPos(NULL, 0, 0, w, h, 0);
	}

	/// 将窗口放大到全屏
	/// @see set_size()
	void fullscr()
	{
		int cx = ::GetSystemMetrics(SM_CXSCREEN);
		int cy = ::GetSystemMetrics(SM_CYSCREEN);
		set_size(cx,cy);
	}

	/// 相对移动窗口
	/// @param x 相对水平位移
	/// @param y 相对垂直位移
	void move(int x, int y)
	{
		CHECK_VALID;
		window_rect rc(this);
		rc.OffsetRect(x,y);
		SetWindowPos(NULL, rc.left, rc.top, 0, 0, SWP_NOSIZE);
	}

	void center(CWnd* alt=NULL)
	{
		CHECK_VALID;

		CenterWindow(alt);
	}
};
#endif	// _WNDPLACE_H

⌨️ 快捷键说明

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