📄 full_dlg.h
字号:
#ifndef _FULL_DLG_H
#define _FULL_DLG_H
template<class T>
class full_dlg: public T
{
CRect rc;
bool fulled;
DWORD style;
CWnd* owner;
void init(){fulled=false; style=0; owner = NULL;}
public:
typedef full_dlg<T> baseclass;
full_dlg(){init();}
full_dlg(CWnd* p): T(p){init();}
full_dlg(UINT idd, CWnd* p): T(idd, p){init();}
virtual void full_scr()
{
if( fulled )
return;
style = GetExStyle();
ModifyStyleEx(WS_EX_CLIENTEDGE | WS_EX_APPWINDOW, 0, SWP_FRAMECHANGED | SWP_DRAWFRAME);
GetWindowRect(rc);
if( GetStyle() & WS_CHILD )
{
owner = GetParent();
ModifyStyle( WS_CHILD, WS_POPUP, 0);
//SetOwner(NULL);
SetParent(NULL);
owner->ScreenToClient(rc);
}
int cx = ::GetSystemMetrics(SM_CXSCREEN);
int cy = ::GetSystemMetrics(SM_CYSCREEN);
MoveWindow(CRect(0,0,cx,cy));
fulled = true;
}
virtual void restore()
{
if( !fulled )
return;
fulled = false;
if( owner )
{
SetOwner(owner);
SetParent(owner);
ModifyStyle(WS_POPUP, WS_CHILD, 0);
}
MoveWindow(rc);
ModifyStyleEx(0, style, SWP_DRAWFRAME);
if( GetParent() )
GetParent()->SetFocus();
}
void toggle()
{
if( fulled )
restore();
else
full_scr();
}
bool is_fulled() const {return fulled;}
protected:
virtual LRESULT DefWindowProc(UINT msg, WPARAM w, LPARAM l)
{
if( msg == WM_KILLFOCUS )
{
restore();
}
return T::DefWindowProc(msg, w, l);
}
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -