本文介绍了如果我们在y方向上设置位置,如何控制小部件的速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在一个c ++项目中,我有一个代码来设置小部件在y方向上的位置,我的代码也在编译和运行,并且位置在y方向上发生了变化.我的问题是它的速度非常快,我的要求是将widget沿y方向缓慢移动.请帮帮我.
我的代码是
Hi all,
I am working a c++ project,i have a code for set the position of widget in y direction my code is compiling and run also,and the position change in y direction. My problem is that its speed is very fast,my requirement is move slow the widget in y direction. Please help me.
my code is
mtitlebar->SetPositionX(0);
mtitlebar->SetPositionY(500);
小部件位置沿y方向移动,但是其速度非常快.请帮忙.
谢谢&问候
the widget postion move in y direction but its speed is very fast. please help.
Thanks & Regards
推荐答案
movement_speed = 10; // in milliseconds
old_y_position = 0;
new_y_position = 200;
for( ; old_y_position <= new_y_position ; old_y_position++ ) {
Sleep(movement_speed);
mtitlebar->SetPositionY(old_y_position);
}
这篇关于如果我们在y方向上设置位置,如何控制小部件的速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!