Advertisement
Nikolcho

gosho

Jun 11th, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 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 tanks
  12. {
  13. public partial class FormMain : Form
  14. {
  15. int firstReminder = 0;
  16. int secondReminder = 0;
  17. public FormMain()
  18. {
  19. InitializeComponent();
  20. }
  21.  
  22. private void btnright_Click(object sender, EventArgs e)
  23. {
  24. pictureBox1.Image = Properties.Resources.Right;
  25. pictureBox1.Left += 10;
  26.  
  27. if (pictureBox1.Left >= 650 - 100)
  28. {
  29. pictureBox1.Left = 650 - 100;
  30. }
  31. }
  32.  
  33. private void btnLEFT_Click(object sender, EventArgs e)
  34. {
  35. pictureBox1.Image = Properties.Resources.Left;
  36. pictureBox1.Left -= 10;
  37.  
  38. if (pictureBox1.Left <= 0)
  39. {
  40. pictureBox1.Left = 0;
  41. }
  42. }
  43.  
  44. private void btnUP_Click(object sender, EventArgs e)
  45. {
  46. pictureBox1.Image = Properties.Resources.Up;
  47. pictureBox1.Top -= 10;
  48.  
  49. if (pictureBox1.Top <= 0)
  50. {
  51. pictureBox1.Top = 0;
  52. }
  53. }
  54.  
  55. private void button1_Click(object sender, EventArgs e)
  56. {
  57. pictureBox1.Width += 10;
  58. pictureBox1.Height += 10;
  59. pictureBox1.Top -= 5;
  60. pictureBox1.Left -= 5;
  61.  
  62. if (pictureBox1.Width >= 200 && pictureBox1.Height >= 200)
  63. {
  64. pictureBox1.Width = 200;
  65. pictureBox1.Height = 200;
  66.  
  67. if (firstReminder++ > 0)
  68. {
  69. pictureBox1.Top = pictureBox1.Top + 5;
  70. pictureBox1.Left = pictureBox1.Left + 5;
  71. }
  72. }
  73. }
  74.  
  75. private void FormMain_Load(object sender, EventArgs e)
  76. {
  77.  
  78. }
  79.  
  80. private void button2_Click(object sender, EventArgs e)
  81. {
  82. pictureBox1.Width -= 10;
  83. pictureBox1.Height -= 10;
  84. pictureBox1.Top += 5;
  85. pictureBox1.Left += 5;
  86.  
  87.  
  88.  
  89. if (pictureBox1.Width <= 20 && pictureBox1.Height <= 20)
  90. {
  91. pictureBox1.Width = 20;
  92. pictureBox1.Height = 20;
  93. if (secondReminder++ > 0)
  94. {
  95. pictureBox1.Top = pictureBox1.Top - 5;
  96. pictureBox1.Left = pictureBox1.Left - 5;
  97. }
  98.  
  99. }
  100. }
  101.  
  102. private void btnDOWN_Click_1(object sender, EventArgs e)
  103. {
  104. pictureBox1.Image = Properties.Resources.Down;
  105. pictureBox1.Top += 10;
  106.  
  107. if (pictureBox1.Top >= 317 - 115)
  108. {
  109. pictureBox1.Top = 317 - 115;
  110. }
  111. }
  112. }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement