المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Drawing a line that follows a moving point



C# Programming
09-11-2013, 11:25 PM
Hello, I'm very new to C# programming, in fact I only started about 3 months ago and have no formal training, only on the job. I have the need to draw a line on a windows form, that follows a moving point. there are actually 2 points I need to follow creating 2 separate lines. below is the code that creates the moving points:

private void timer1_Tick(object sender, EventArgs e) { Double X1, Y1, A, B; int x2, y2, c, d; X1 = 300 + (708 * (30 - simNumber14.OldValue) / 30); Y1 = 495 - (354 * simNumber6.OldValue / 31.5); x2 = (int)X1; y2 = (int)Y1; tietrack.******** = new Point(x2, y2); A = 297 + (711 * (30 - simNumber14.OldValue) / 30); B = 704 - (158 * (Math.Max((simNumber3.OldValue - 19.49), 0))/ 15); c = (int)A; d = (int)B; tietrack2.******** = new Point(c, d); }
A timer variable (simNumber14.OldValue) counts down from 30 minutes to 0, and the points move back to their origins and start to track again. At which point the lines they created over the first 30 minutes would be gone and new ones would start. the process would repeat itself as long as it was asked to. I can't imagine it would be that hard, but I'm very new to this.

Thanks