c# - WindowsFormsApplication moving label to a specific coordinates using timer (animation style) -


please help

first of i'll make myself clear, don't want use wpf application animation 2nd want use purely c# windowsformsapplication only.

so here problem, how can move label @ point a specific coordinate of point b precisely using timer?

example: have label1 @ coordinates (0, 0) want move (336, 53) every tick of timer1 (1 ms). code below kinda works on these coordinates, further explanation, 336/53 6 remainder 18, used 6 updating p.x in every timer tick, used 18 f every value of time divisible 18 label1 hit (336, 53) mark.

the main problem example want move (0, 0) (200, 101) doesn't work.furthermore if p.x , p.y accept float values such 1.9 shouldn't problem. thank in advance...

private void timer1_tick(object sender, eventargs e) {         time++; // initialized int time = 0;          if (time % 18 == 0) //btw p point p = new point(); below line             p.x += 1;       //means every 18 pixels traveled x add 1 pixel         p.y += 1;                    p.x += 6;         label1.location = p; } 


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -