N netwang Unregistered / Unconfirmed GUEST, unregistred user! 2010-04-11 #1 窗体有一个panel和button,点击button时, panel先快速移动,然后减速移动到某一位置停止。怎么实现这样的效果
L LUJIAYU110 Unregistered / Unconfirmed GUEST, unregistred user! 2010-04-11 #2 1.要用到定时器2.移动就是位置变化,即改变PANEL的TOP和LEFT.3.移动快慢通过改变TIMER的INTERVAL值实现4.在ONTIMER中写代码,判断位置,改变PANEL坐标.
L liuls Unregistered / Unconfirmed GUEST, unregistred user! 2010-04-12 #4 procedure TForm1.Button1Click(Sender: TObject);var I: Integer;begin for I := 0 to 10 do begin Sleep(30); pnl1.Left := pnl1.Left + I * 5; pnl1.Refresh; end; for I := 0 to 5 do begin Sleep(100); pnl1.Left := pnl1.Left + I * 5; pnl1.Refresh; end;end;
procedure TForm1.Button1Click(Sender: TObject);var I: Integer;begin for I := 0 to 10 do begin Sleep(30); pnl1.Left := pnl1.Left + I * 5; pnl1.Refresh; end; for I := 0 to 5 do begin Sleep(100); pnl1.Left := pnl1.Left + I * 5; pnl1.Refresh; end;end;
K kunwyf12345 Unregistered / Unconfirmed GUEST, unregistred user! 2010-04-13 #5 用gdi+实现,那个GDI+里例子就有这个功能的实现,闪动的解决办法是self.DoubleBuffered:=true;
K kunwyf12345 Unregistered / Unconfirmed GUEST, unregistred user! 2010-04-13 #6 例子在万一老师的delphi全掌握的gdi+里,delphi全掌握你可以在盒子论坛上下载