Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace TI_Semester_2
- {
- public partial class TI_12_04_18 : Form
- {
- int Vurr_Numb = 0;
- // int muudubX = 1;
- // int muudubY = 1;
- int suund = 1;
- Pen myPen = new Pen(Color.Black, 3);
- Graphics g;
- public TI_12_04_18()
- {
- InitializeComponent();
- }
- private void TI_timer1_Tick(object sender, EventArgs e)
- {
- if (Vurr_Numb > 5) Vurr_Numb=0;
- TI_Vurr.Image = TI_Images.Images[Vurr_Numb];
- if ((TI_Vurr.Left + TI_Vurr.Width + 10) > TI_groupBox1.Width) suund = -1;
- if (TI_Vurr.Left < 10) suund = 1;
- int x1 = TI_Vurr.Left + TI_Vurr.Width / 2;
- int y1 = TI_Vurr.Top + TI_Vurr.Height;
- if (TI_XTelg.Checked)
- {
- TI_Vurr.Left += (10 * suund);
- }
- if(TI_Diag.Checked)
- {
- if( suund==1)
- {
- double X = TI_groupBox1.Width - (TI_Vurr.Left + TI_Vurr.Width);
- double Y = TI_Vurr.Top;
- double R = Math.Pow(X * X + Y * Y, 0.5);
- double dx = X / R * 10;
- double dy = Y / R * 10;
- TI_Vurr.Left += (int)dx;
- TI_Vurr.Top -= (int)dy;
- }
- else
- {
- double X = TI_Vurr.Left;
- double Y = TI_groupBox1.Height - (TI_Vurr.Top + TI_Vurr.Height);
- double R = Math.Pow(X * X + Y * Y, 0.5);
- double dx = X / R * 10;
- double dy = Y / R * 10;
- TI_Vurr.Left -= (int)dx;
- TI_Vurr.Top += (int)dy;
- }
- }
- if (TI_D2.Checked)
- {
- }
- int x2 = TI_Vurr.Left + TI_Vurr.Width / 2;
- int y2 = TI_Vurr.Top + TI_Vurr.Height;
- g.DrawLine(myPen, x1, y1, x1, y2);
- /* Vurr_Numb++;
- if (Vurr_Numb > 5) Vurr_Numb = 0;
- TI_Vurr.Image = TI_Images.Images[Vurr_Numb];
- if (TI_Vurr.Left > TI_groupBox1.Width - TI_Vurr.Width)
- {
- muudubX = -1;
- }
- if (TI_Vurr.Top > TI_groupBox1.Height - TI_Vurr.Height)
- {
- muudubY = -1;
- }
- if (TI_Vurr.Left < 0)
- {
- muudubX = 1;
- }
- if (TI_Vurr.Top < 0)
- {
- muudubY = 1;
- }
- if (TI_radioButton1.Checked)
- {
- TI_Vurr.Left += 9*muudubX;
- TI_Vurr.Top += 9*muudubY;
- }
- if (TI_radioButton2.Checked)
- {
- TI_Vurr.Left += 0;
- }*/
- }
- private void TI_Visible_CheckedChanged(object sender, EventArgs e)
- {
- TI_Vurr.Visible = TI_Visible.Checked;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement