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.Windows.Forms;
- namespace Ne_znam_kocka_iks
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- this.FormBorderStyle = FormBorderStyle.None;
- this.Bounds = Screen.PrimaryScreen.Bounds;
- }
- int x,y,b,n,o,p,q,r,s,z,t,l,m,c;
- int[,] a;
- private void Form1_Load(object sender, EventArgs e)
- {
- t = 0;
- m = 0;
- o = -10;
- r = x / 8;
- s = 0;
- b = 8;
- n = 10;
- x = ClientRectangle.Width;
- y = ClientRectangle.Height;
- a = new int[b, n];
- q = x / 8;
- c = y / 12 + 4;
- z = x - x / 8 + 10;
- l = x / 8 - 4;
- p = y - y / 12 - 27;
- }
- private void Form1_Paint(object sender, PaintEventArgs e)
- {
- SolidBrush cetkaa = new SolidBrush(Color.Blue);
- SolidBrush petka = new SolidBrush(Color.Yellow);
- Graphics g = CreateGraphics();
- SolidBrush cetka = new SolidBrush(Color.Black);
- g.FillRectangle(cetkaa, o + r, p +s, q, c);
- g.FillRectangle(petka, z + t, l + m, q, c);
- /* for (int i = 0; i < x; i++)
- {
- for (int j = 0; j < y; j++)
- {
- g.FillRectangle(cetka, i * 55, j, 2, 2);
- g.FillRectangle(cetka, i, j * 55, 2, 2);
- }
- }*/
- }
- private void Form1_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Up)
- {
- p -= y / 10-3;
- }
- if (e.KeyCode == Keys.Down)
- {
- p += y / 10-3;
- }
- if (e.KeyCode == Keys.Left)
- {
- o -= x/8+4;
- }
- if (e.KeyCode == Keys.Right)
- {
- o += x/8+4;
- }
- if (e.KeyCode == Keys.W)
- {
- m -= y / 10-3;
- }
- if (e.KeyCode == Keys.S)
- {
- m += y / 10-3;
- }
- if (e.KeyCode == Keys.A)
- {
- t -= x / 8+4;
- }
- if (e.KeyCode == Keys.D)
- {
- t += x / 8 + 4;
- }
- Refresh();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement