?? detail_dlg.h
字號:
/*
* File: detail_dlg.h
* Function: make a dialog can extend and shrine
* Usage: create a dialog derive from this, like:
class CTestDlg: detail_dlg<CDialog>
{
...
};
and place a separator line in the dialog, named "ID_SEP"
then in the dialog constructor:
CTestDlg::CTestDlg(CWnd* parent = NULL ):
base(ID_SEP, CTestDlg::IDD, parent)
{
...
}
ok, now use "simple()" and "detail()" freely. isnt it wonderful?
* Author: nodman
* History: 2003-2-x created, nodman
* 2003-9-3 modified, nodman
*/
#ifndef _DETAILDLG_H
#define _DETAILDLG_H
#include "utils.h"
#include "rect.h"
template<class T>
class detail_dlg: public T
{
typedef T baseclass;
public:
typedef detail_dlg<baseclass> base;
detail_dlg( UINT idDlg, CWnd *pParent = NULL):
baseclass(idDlg, pParent), nID(0)
{
}
protected:
virtual BOOL OnInitDialog()
{
baseclass::OnInitDialog();
on_init();
return TRUE;
}
void on_init()
{
CenterWindow();
GetWindowRect( rcOrig );
CWnd *p = GetDlgItem( nID );
if( !p )
return;
window_rect rc(p);
nSepY = rc.top - rcOrig.top;
}
bool detailed()
{
CWnd* p = GetDlgItem(nID);
if( !p )
return true;
return FALSE != p->IsWindowVisible();
}
void detail()
{
if( detailed() )
return;
window_rect rc(this);
rc.bottom = rc.top + rcOrig.Height();
SetWindowPos( NULL, 0, 0, rc.Width(), rc.Height(), SWP_NOMOVE | SWP_NOZORDER );
GetDlgItem(nID)->ShowWindow(SW_SHOW);
}
void simple()
{
//if( !detailed() )
// return;
window_rect rc(this);
rc.bottom = rc.top + nSepY;
SetWindowPos( NULL, 0, 0, rc.Width(), rc.Height(), SWP_NOMOVE | SWP_NOZORDER );
GetDlgItem(nID)->ShowWindow(SW_HIDE);
}
void set_sepid(UINT sepid)
{
nID = sepid;
}
private:
CRect rcOrig;
UINT nID;
UINT nSepY;
};
#endif // _DETAILDLG_H
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -