动画窗口幻灯片
我希望我的表单向下滑动并返回到带有幻灯片动画的位置,如何制作正确的 AnimateWinows,如果它确实是真的......
void __fastcall TUsers::BitBtn1Click(TObject *Sender)
{
if (!pressed)
{
Height=700;
//AnimateWindow(Handle, 500, AW_CENTER | AW_SLIDE | AW_VER_POSITIVE);
pressed=true;
}
else
{
pressed=false;
//AnimateWindow(Handle, 500, AW_CENTER | AW_SLIDE | AW_VER_NEGATIVE);
Height=425;
}
}
对版主:这里没有嘀咕 Builder 或 Delphi :)
I want my form slide down and back to position with slide animation, how to make correct AnimateWinows, if it real for sure ...
void __fastcall TUsers::BitBtn1Click(TObject *Sender)
{
if (!pressed)
{
Height=700;
//AnimateWindow(Handle, 500, AW_CENTER | AW_SLIDE | AW_VER_POSITIVE);
pressed=true;
}
else
{
pressed=false;
//AnimateWindow(Handle, 500, AW_CENTER | AW_SLIDE | AW_VER_NEGATIVE);
Height=425;
}
}
to moderators : here is no mutters Builder or Delphi :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您有兴趣自己控制动画,这里是我们为实现此目的而编写的代码示例。它看起来和工作都很棒。我们在主窗体上的 TPanel 控件内从右向左滑动 Tform1。我们确保在 MyCreate 中正确设置 Self.Parent 和 DoubleBuffered。先按 ShiftLeft,然后按 ShiftRight 即可完成工作。对于某些用户来说,我们遇到了 Self.Top 被移动的问题,因此我们确保每次迭代以及完全移动时 Self.Top := 0。这解决了我们看到的所有奇怪问题。
希望这有帮助!
If you are interested in controlling the animation yourself, here is a sample of code we wrote to accomplish that. It looks and works great. We are sliding Tform1 from the right to the left within a TPanel control on the main form. We ensure that Self.Parent and DoubleBuffered gets set correctly in MyCreate. ShiftLeft and then ShiftRight do the work. We ran into a problem for certain users where the Self.Top was being shifted so we are making sure that Self.Top := 0 with each iteration and when fully shifted. That solved all of the weird issues we were seeing.
Hope this helps!
这不是
AnimateWindow
的用途。该函数使用一些动画隐藏或显示窗口。您的窗口已经可见,并且您希望它保持可见,因此AnimateWindow
不适合您。相反,您应该做的是循环地不断升高或降低窗口,直到达到新的所需高度。
That's not what
AnimateWindow
is for. That function hides or shows a window using some animation. Your window is already visible, and you want it to stay visible, soAnimateWindow
is not for you.What you should do instead is make your window successively taller or shorter in a loop until you reach the new desired height.
检查以下链接以获取答案和一个很酷的演示程序。
http:// /delphi.about.com/od/delphi-tips-2011/qt/hide-slide-fade-away-controls-delphi-form.htm
Check the following link for an answer and a cool demo program.
http://delphi.about.com/od/delphi-tips-2011/qt/hide-slide-fade-away-controls-delphi-form.htm