Advertisement
Guest User

Untitled

a guest
May 27th, 2015
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.61 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.Runtime.CompilerServices;
  8. using System.Security.AccessControl;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12.  
  13. namespace SCR_Football
  14. {
  15.     public partial class Form1 : Form
  16.     {
  17.         private const int playerRadius = 50;
  18.         Pen whitePen = new Pen(Color.White, 3);
  19.         Brush grass = new SolidBrush(Color.DarkOliveGreen); // texturebrush?
  20.         private readonly System.Drawing.Graphics fieldGraphics;
  21.  
  22.         public Form1()
  23.         {
  24.             InitializeComponent();
  25.             fieldGraphics = fieldPictureBox.CreateGraphics();
  26.             this.FormBorderStyle = FormBorderStyle.FixedDialog;
  27.         }
  28.  
  29.         private void button1_Click(object sender, EventArgs e)
  30.         {
  31.             DrawField();
  32.         }
  33.  
  34.         private void DrawField()
  35.         {
  36.             Point[] fieldPoints = new Point[]
  37.             {
  38.                 new Point(0, 50),
  39.                 new Point(150, 50),
  40.                 new Point(150, 0),
  41.                 new Point(250, 0),
  42.                 new Point(250, 50),
  43.                 new Point(400, 50),
  44.                 new Point(400, 550),
  45.                 new Point(250, 550),
  46.                 new Point(250, 600),
  47.                 new Point(150, 600),
  48.                 new Point(150, 550),
  49.                 new Point(0, 550)
  50.             };
  51.             fieldGraphics.FillPolygon(grass, fieldPoints);
  52.             fieldGraphics.DrawPolygon(whitePen, fieldPoints);
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement