Advertisement
Guest User

Untitled

a guest
May 29th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 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.Windows.Forms;
  9.  
  10. namespace Ne_znam_kocka_iks
  11. {
  12. public partial class Form1 : Form
  13. {
  14. public Form1()
  15. {
  16. InitializeComponent();
  17. this.FormBorderStyle = FormBorderStyle.None;
  18. this.Bounds = Screen.PrimaryScreen.Bounds;
  19. }
  20. int x,y,b,n,o,p,q,r,s,z,t,l,m,c;
  21. int[,] a;
  22.  
  23.  
  24.  
  25.  
  26. private void Form1_Load(object sender, EventArgs e)
  27. {
  28.  
  29.  
  30. t = 0;
  31. m = 0;
  32. o = -10;
  33. r = x / 8;
  34. s = 0;
  35. b = 8;
  36. n = 10;
  37. x = ClientRectangle.Width;
  38. y = ClientRectangle.Height;
  39. a = new int[b, n];
  40. q = x / 8;
  41. c = y / 12 + 4;
  42. z = x - x / 8 + 10;
  43. l = x / 8 - 4;
  44. p = y - y / 12 - 27;
  45.  
  46.  
  47. }
  48.  
  49.  
  50. private void Form1_Paint(object sender, PaintEventArgs e)
  51. {
  52.  
  53.  
  54. SolidBrush cetkaa = new SolidBrush(Color.Blue);
  55. SolidBrush petka = new SolidBrush(Color.Yellow);
  56. Graphics g = CreateGraphics();
  57. SolidBrush cetka = new SolidBrush(Color.Black);
  58.  
  59. g.FillRectangle(cetkaa, o + r, p +s, q, c);
  60. g.FillRectangle(petka, z + t, l + m, q, c);
  61.  
  62.  
  63.  
  64.  
  65.  
  66. /* for (int i = 0; i < x; i++)
  67. {
  68.  
  69. for (int j = 0; j < y; j++)
  70. {
  71.  
  72. g.FillRectangle(cetka, i * 55, j, 2, 2);
  73. g.FillRectangle(cetka, i, j * 55, 2, 2);
  74.  
  75.  
  76. }
  77.  
  78. }*/
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86. }
  87.  
  88. private void Form1_KeyDown(object sender, KeyEventArgs e)
  89. {
  90.  
  91. if (e.KeyCode == Keys.Up)
  92. {
  93. p -= y / 10-3;
  94.  
  95. }
  96.  
  97. if (e.KeyCode == Keys.Down)
  98. {
  99. p += y / 10-3;
  100.  
  101. }
  102.  
  103. if (e.KeyCode == Keys.Left)
  104. {
  105. o -= x/8+4;
  106.  
  107. }
  108.  
  109. if (e.KeyCode == Keys.Right)
  110. {
  111. o += x/8+4;
  112.  
  113. }
  114.  
  115. if (e.KeyCode == Keys.W)
  116. {
  117. m -= y / 10-3;
  118. }
  119.  
  120. if (e.KeyCode == Keys.S)
  121. {
  122. m += y / 10-3;
  123. }
  124.  
  125. if (e.KeyCode == Keys.A)
  126. {
  127. t -= x / 8+4;
  128. }
  129.  
  130. if (e.KeyCode == Keys.D)
  131. {
  132. t += x / 8 + 4;
  133. }
  134. Refresh();
  135.  
  136. }
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145. }
  146. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement