📄 dlgitemresizer.h
字号:
#if !defined(AFX_DLGITEMRESIZER_H__C1E23966_0DD5_11D3_8745_00105A48D360__INCLUDED_)
#define AFX_DLGITEMRESIZER_H__C1E23966_0DD5_11D3_8745_00105A48D360__INCLUDED_
#include <vector>
//
// This struct is used to hold information
// about the added controls
//
typedef struct _DLGITEMINFO
{
UINT m_uFlags;
HWND m_hWnd;
CRect m_rectPosition;
}DLGITEMINFO;
typedef std::vector<DLGITEMINFO*> VEC_DLGITEMINFO;
const UINT RESIZE_LOCKLEFT = 0x0001; // Distance to left is fixed
const UINT RESIZE_LOCKRIGHT = 0x0002; // Distance to right is fixed
const UINT RESIZE_LOCKTOP = 0x0004; // Distance to top is fixed
const UINT RESIZE_LOCKBOTTOM = 0x0008; // Distance to bottom is fixed
const UINT RESIZE_SHOWHIDE = 0x0010; // Show/hide if not fully visible
const UINT RESIZE_LOCKALL = RESIZE_LOCKLEFT|RESIZE_LOCKRIGHT|RESIZE_LOCKTOP|RESIZE_LOCKBOTTOM;
const UINT RESIZE_LOCKTOPLEFT = RESIZE_LOCKLEFT|RESIZE_LOCKTOP;
const UINT RESIZE_LOCKBOTTOMRIGHT = RESIZE_LOCKBOTTOM|RESIZE_LOCKRIGHT;
class CDlgItemResizer {
public:
CDlgItemResizer();
virtual ~CDlgItemResizer();
void ScreenToClient(HWND hWnd, CRect* rect);
// Adds a control to the resize list
void Add(HWND hWnd, UINT uFlags);
void Add(HWND hWnd, INT nCtrlID, UINT uFlags)
{
Add(GetDlgItem(hWnd, nCtrlID), uFlags);
}
// Resizes the controls in the window
void Resize(HWND hWnd);
// Sets the original size of the parent
void SetInitialSize(INT cx, INT cy)
{
m_szInitial = CSize(cx, cy);
}
// Sets the original size of the parent
void SetInitialSize(const CSize &size)
{
m_szInitial = size;
}
// Returns the initial size
CSize GetInitialSize() const
{
return m_szInitial;
}
protected:
VEC_DLGITEMINFO m_vecControls;
CSize m_szInitial;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -