Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace TI_Semester_2
  12. {
  13. public partial class TI_12_04_18 : Form
  14.  
  15. {
  16. int Vurr_Numb = 0;
  17. // int muudubX = 1;
  18. // int muudubY = 1;
  19. int suund = 1;
  20. Pen myPen = new Pen(Color.Black, 3);
  21. Graphics g;
  22.  
  23. public TI_12_04_18()
  24. {
  25. InitializeComponent();
  26.  
  27. }
  28.  
  29. private void TI_timer1_Tick(object sender, EventArgs e)
  30. {
  31.  
  32. if (Vurr_Numb > 5) Vurr_Numb=0;
  33. TI_Vurr.Image = TI_Images.Images[Vurr_Numb];
  34. if ((TI_Vurr.Left + TI_Vurr.Width + 10) > TI_groupBox1.Width) suund = -1;
  35. if (TI_Vurr.Left < 10) suund = 1;
  36.  
  37. int x1 = TI_Vurr.Left + TI_Vurr.Width / 2;
  38. int y1 = TI_Vurr.Top + TI_Vurr.Height;
  39.  
  40. if (TI_XTelg.Checked)
  41. {
  42. TI_Vurr.Left += (10 * suund);
  43. }
  44.  
  45.  
  46. if(TI_Diag.Checked)
  47. {
  48. if( suund==1)
  49. {
  50. double X = TI_groupBox1.Width - (TI_Vurr.Left + TI_Vurr.Width);
  51. double Y = TI_Vurr.Top;
  52. double R = Math.Pow(X * X + Y * Y, 0.5);
  53. double dx = X / R * 10;
  54. double dy = Y / R * 10;
  55. TI_Vurr.Left += (int)dx;
  56. TI_Vurr.Top -= (int)dy;
  57. }
  58.  
  59. else
  60. {
  61. double X = TI_Vurr.Left;
  62. double Y = TI_groupBox1.Height - (TI_Vurr.Top + TI_Vurr.Height);
  63. double R = Math.Pow(X * X + Y * Y, 0.5);
  64. double dx = X / R * 10;
  65. double dy = Y / R * 10;
  66. TI_Vurr.Left -= (int)dx;
  67. TI_Vurr.Top += (int)dy;
  68. }
  69. }
  70.  
  71. if (TI_D2.Checked)
  72. {
  73.  
  74. }
  75. int x2 = TI_Vurr.Left + TI_Vurr.Width / 2;
  76. int y2 = TI_Vurr.Top + TI_Vurr.Height;
  77. g.DrawLine(myPen, x1, y1, x1, y2);
  78.  
  79.  
  80.  
  81. /* Vurr_Numb++;
  82. if (Vurr_Numb > 5) Vurr_Numb = 0;
  83. TI_Vurr.Image = TI_Images.Images[Vurr_Numb];
  84.  
  85. if (TI_Vurr.Left > TI_groupBox1.Width - TI_Vurr.Width)
  86. {
  87. muudubX = -1;
  88. }
  89.  
  90. if (TI_Vurr.Top > TI_groupBox1.Height - TI_Vurr.Height)
  91. {
  92. muudubY = -1;
  93. }
  94.  
  95. if (TI_Vurr.Left < 0)
  96. {
  97. muudubX = 1;
  98. }
  99.  
  100. if (TI_Vurr.Top < 0)
  101. {
  102. muudubY = 1;
  103. }
  104.  
  105. if (TI_radioButton1.Checked)
  106. {
  107. TI_Vurr.Left += 9*muudubX;
  108. TI_Vurr.Top += 9*muudubY;
  109.  
  110. }
  111.  
  112. if (TI_radioButton2.Checked)
  113. {
  114. TI_Vurr.Left += 0;
  115. }*/
  116.  
  117. }
  118.  
  119. private void TI_Visible_CheckedChanged(object sender, EventArgs e)
  120. {
  121. TI_Vurr.Visible = TI_Visible.Checked;
  122. }
  123. }
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement