void CQQHideWndDlg::DoShow()
{
if(m_hideMode == HM_NONE)
return;CRect tRect;
GetWindowRect(tRect);
INT height = tRectHeight();
INT width = tRectWidth(); INT steps =
; switch(m_hideMode)
{
case HM_TOP:
steps = height/HS_STEPS;
tRecttop += steps;
if(tRecttop >= m_edgeHeight)
{ //你可以把下面一句替換上面的+=| =steps 達到取消抽屜效果
//更好的辦法是添加個BOOL值來控制其他case同樣
tRecttop = m_edgeHeight;
m_hsFinished = TRUE; //完成顯示過程
}
tRectbottom = tRect top + height;
break;
case HM_BOTTOM:
steps = height/HS_STEPS;
tRecttop = steps;
if(tRecttop <= (GetSystemMetrics(SM_CYSCREEN) height))
{
tRecttop = GetSystemMetrics(SM_CYSCREEN) height;
m_hsFinished = TRUE;
}
tRectbottom = tRect top + height;
break;
case HM_LEFT:
steps = width/HS_STEPS;
tRectright += steps;
if(tRectright >= width)
{
tRectright = width;
m_hsFinished = TRUE;
}
tRectleft = tRect right width;
tRecttop = m_edgeHeight;
tRectbottom = GetSystemMetrics(SM_CYSCREEN) m_taskBarHeight;
break;
case HM_RIGHT:
steps = width/HS_STEPS;
tRectleft = steps;
if(tRectleft <= (GetSystemMetrics(SM_CXSCREEN) width))
{
tRectleft = GetSystemMetrics(SM_CXSCREEN) width;
m_hsFinished = TRUE;
}
tRectright = tRect left + width;
tRecttop = m_edgeHeight;
tRectbottom = GetSystemMetrics(SM_CYSCREEN) m_taskBarHeight;
break;
default:
break;
}SetWindowPos(&wndTopMost
tRect);
}BOOL CQQHideWndDlg::SetWindowPos(const CWnd* pWndInsertAfter
LPCRECT pCRect
UINT nFlags)
{
return CDialog::SetWindowPos(pWndInsertAfterpCRect >left pCRect >top
pCRect>right pCRect >left pCRect >bottom pCRect >top nFlags);
}
到此
三
雖然還不能算是完美的模仿
QQ的成功很大部分在於他的界面比較人性化(用了MSN後深有感受)
[
From:http://tw.wingwit.com/Article/program/net/201311/15312.html