简体   繁体   English

如何动态移动/调整表单大小?

[英]How can I dynamically move/resize a form?

I am doing an alert system that will show messages 'a la' Messenger, and I want them to move or resize to make them appear. 我正在执行一个警报系统,该系统将显示消息“ la la Messenger”,并且希望它们移动或调整大小以使其出现。

How can I do this without having to do this: 我如何做到这一点而不必这样做:

do
{
this.prop += 1;
} while (this. prop  = destination);

您需要制作一个Timer组件,并在计时器的Tick事件中调用表单的SetBounds方法。

设置form.size属性以更改大小,设置form.position以更改位置

You need a frame rate independent interpolator. 您需要一个独立于帧率的插值器。

Take a look at: Frame Rate Independent interpolation . 看一下: 独立帧速率的插值 Basically, the idea is that you compute what your current position should be based upon the expected animation time and how long you've been animating... This means that the animation will take the same amount of time to go from point a to point b on any hardware. 基本上,您的想法是根据预期的动画时间和进行动画的时间来计算当前位置应该是多少...这意味着动画从点到点花费的时间相同b在任何硬件上。

Of course, you'll need to position the form with the values coming out of this, but thats the easy part! 当然,您需要使用由此产生的值来定位表单,但这很简单!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在窗体调整大小的面板中移动所有控件? - How can I move all the controls in a panel on form resize? 如何移动和调整由绘图创建的线? - How can I move and resize a line which was created by drawing? 如何禁用Windows窗体的大小调整和移动 - How to disable both Resize and Move for a Windows Form 如何在没有边框的情况下移动和调整窗体大小? - How to move and resize a form without a border? 在扩展表单时,如何自动移动和调整按钮和标签的大小? - How do I automatically move and resize buttons and labels when a form is expanded? 如何将控件移动到页面中动态添加的用户控件中? - How can I move controls into a dynamically added usercontrol into page? 动态创建,移动和调整控件大小 - Dynamically Create,Move And Resize The Controls 如何在调整表单大小时按比例调整 DataGridView 的大小? - How can I proportionally resize a DataGridView when a form resizes? 如何在WPF表单上动态移动选项卡控件 - How to move a tab control dynamically on a wpf form 我如何以编程方式操作Windows 7屏幕键盘osk:移动,调整大小,删除标题栏/标题 - How can i programmatically manipulate the Windows 7 on-screen keyboard osk: Move, Resize, Remove Titlebar/Caption
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM