对话框的隐藏和出现
2016-07-20 11:36
288 查看
CRect rc;
int moves = 10; //动画滚动窗体的步数
int xStep, yStep;
int xEnd, yEnd;
int width;
int height;
GetWindowRect(&rc);
width = rc.right - rc.left;
height = rc.bottom - rc.top;
//下边判断窗体该如何移动,由停靠方式决定
switch (alignType)
{
case ALIGN_TOP:
{
//向上隐藏
xStep = 0;
xEnd = rc.left;
if (hide)
{
yStep = -rc.bottom / moves;
yEnd = -height + NEAR_SIDE ;
}
else
{
yStep = -rc.top / moves;
yEnd = 0;
}
break;
}
case ALIGN_LEFT:
{
//向左隐藏
yStep = 0;
yEnd = rc.top;
if (hide)
{
xStep = -rc.right / moves;
xEnd = -width + NEAR_SIDE;
}
else
{
xStep = -rc.left / moves;
xEnd = 0;
}
break;
}
case ALIGN_RIGHT:
{
//向右隐藏
yStep = 0;
yEnd = rc.top;
if (hide)
{
xStep = (ScreenX - rc.left) / moves;
xEnd = ScreenX - NEAR_SIDE;
}
else
{
xStep = (ScreenX - rc.right) / moves;
xEnd = ScreenX - width;
}
break;
}
default:
{
return;
}
}
//动画滚动窗体.
for (int i = 0; i < moves; i++)
{
rc.left += xStep;
rc.top += yStep;
SetWindowPos(NULL, rc.left, rc.top, width, height,SWP_NOSIZE | SWP_NOSENDCHANGING);
RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
//UpdateWindow();
Sleep(2);
}
SetWindowPos(&wndTopMost, xEnd, yEnd,width, height, SWP_NOSIZE);
//如果窗体已被显示,设置定时器,监视鼠标
if (!hide)
{
SetTimer(WM_TIMER, 50, NULL);
}
CRect rc;
int moves = 10; //动画滚动窗体的步数
int xStep, yStep;
int xEnd, yEnd;
int width;
int height;
GetWindowRect(&rc);
width = rc.right - rc.left;
height = rc.bottom - rc.top;
//下边判断窗体该如何移动,由停靠方式决定
switch (alignType)
{
case ALIGN_TOP:
{
//向上隐藏
xStep = 0;
xEnd = rc.left;
if (hide)
{
yStep = -rc.bottom / moves;
yEnd = -height + NEAR_SIDE ;
}
else
{
yStep = -rc.top / moves;
yEnd = 0;
}
break;
}
case ALIGN_LEFT:
{
//向左隐藏
yStep = 0;
yEnd = rc.top;
if (hide)
{
xStep = -rc.right / moves;
xEnd = -width + NEAR_SIDE;
}
else
{
xStep = -rc.left / moves;
xEnd = 0;
}
break;
}
case ALIGN_RIGHT:
{
//向右隐藏
yStep = 0;
yEnd = rc.top;
if (hide)
{
xStep = (ScreenX - rc.left) / moves;
xEnd = ScreenX - NEAR_SIDE;
}
else
{
xStep = (ScreenX - rc.right) / moves;
xEnd = ScreenX - width;
}
break;
}
default:
{
return;
}
}
//动画滚动窗体.
for (int i = 0; i < moves; i++)
{
rc.left += xStep;
rc.top += yStep;
SetWindowPos(NULL, rc.left, rc.top, width, height,SWP_NOSIZE | SWP_NOSENDCHANGING);
RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
//UpdateWindow();
Sleep(2);
}
SetWindowPos(&wndTopMost, xEnd, yEnd,width, height, SWP_NOSIZE);
//如果窗体已被显示,设置定时器,监视鼠标
if (!hide)
{
SetTimer(WM_TIMER, 50, NULL);
}
相关文章推荐
- 整理博客记录
- 关于touch事件分发
- SpringMVC从Controller跳转到另一个Controller
- java学习(一):java的编译和执行
- TinyXML经典入门
- Android资源代码 源码 整理 Github开源项目下载地址
- 转载ListCtrl控件
- inout
- HDOJ1222--Wolf and Rabbit
- java程序中动态加载jar包并执行
- 【杭电oj】1995 - 汉诺塔V(思维,递归)
- 【模板】并查集 压缩路径
- spring Model 传递参数的值
- Win10闪屏问题
- 彻底理解宽带信号在频域分解为窄带信号
- Ajax传输中文乱码问题的解决办法
- Java设计模式—适配器模式
- Android view 详解(一)LayoutInflater
- Java设计模式—适配器模式
- CocoaPods安装第三方出错:XCode7.3