<h1>AnimateWindow</h1>The <font color=red>AnimateWindow </font>function enables you to produce special effects when showing or hiding windows. There are two types of animation: <big>roll animation and slide animation. </big>BOOL AnimateWindow( HWND hwnd, // handle to the window to animate DWORD dwTime, // duration of animation DWORD dwFlags // animation type );
我在CMyView::OnDraw()中,Textout(0,0,"Hello world!");想在窗口停止时才显示出来,如何操作!还有窗口如何停止!!!
若我想移动一个Dialog,该在何处调用SetTimer();我一定会加分的!!!
Init()在OnInitDialog中调用。void CTempDlg::Init()
{
int nPixesOK,nPixesCancel,nScreenHeight,nBorder;
POINT point;
CRect rectDlg,rectBtn;
nBorder=GetSystemMetrics(SM_CYBORDER);
nScreenHeight=GetSystemMetrics(SM_CYSCREEN);
GetWindowRect(rectDlg);
m_btnCancel.GetWindowRect(rectBtn);
nPixesCancel=rectDlg.bottom-rectBtn.top;
m_btnOK.GetWindowRect(rectBtn);
nPixesOK=rectDlg.bottom-rectBtn.top;
SetWindowPos(&wndTopMost,0,0,rectDlg.Width(),nScreenHeight,0);
GetWindowRect(rectDlg);
m_btnOK.MoveWindow(rectBtn.left,rectDlg.bottom-nPixesOK-20,rectBtn.Width(),rectBtn.Height());
m_btnCancel.MoveWindow(rectBtn.left,rectDlg.bottom-nPixesCancel-20,rectBtn.Width(),rectBtn.Height());
m_nHideX=2-rectDlg.Width();
SetTimer(IDT_CHECK,10,NULL);
}void CTempDlg::OnOK()
{
// TODO: Add extra validation here
}void CTempDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
CRect rect;
GetWindowRect(rect);
if(nIDEvent==IDT_ANIMATE)
{
if(m_bIsHide)
{
rect.OffsetRect(m_nSpeed,0);
if(rect.left>=m_nShowX)
{
rect.OffsetRect(m_nShowX-rect.left,0);
m_bIsHide=false;
KillTimer(IDT_ANIMATE);
}
MoveWindow(rect);
}
else
{
rect.OffsetRect(-m_nSpeed,0);
if(rect.left<=m_nHideX)
{
rect.OffsetRect(m_nHideX-rect.left,0);
m_bIsHide=true;
KillTimer(IDT_ANIMATE);
}
MoveWindow(rect);
}
}
if(nIDEvent==IDT_CHECK)
{
POINT point;
GetCursorPos(&point);
if(rect.PtInRect(point)==TRUE && m_bIsHide==true)
{
m_bIsHide=false;
AnimateShow();
}
else if(rect.PtInRect(point)==FALSE && m_bIsHide==false)
{
m_bIsHide=true;
AnimateHide();
}
}
CDialog::OnTimer(nIDEvent);
}void CTempDlg::AnimateHide()
{
m_bIsHide=false;
SetTimer(IDT_ANIMATE,5,NULL);
}void CTempDlg::AnimateShow()
{
m_bIsHide=true;
SetTimer(IDT_ANIMATE,5,NULL);
}
HWND hwnd, // handle to the window to animate
DWORD dwTime, // duration of animation
DWORD dwFlags // animation type
);