using System; using System.Collections.Generic; using System.Linq; using System.Drawing; using System.Text; namespace WindowsFormsApplication3 { public class Class1 { public Rectangle[] Snakerec; public SolidBrush Brush; private int x, y, height, width; public void Snake() { Snakerec = new Rectangle[3]; Brush = new SolidBrush(Color.Blue); x = 20; y = 0; height = 10; width = 10; for (int i = 0; i < Snakerec.Length; i++) { Snakerec[i] = new Rectangle(x, y, width, height); x -= 10; } } public void Drawsnake(Graphics paper) { try { foreach(Rectangle rec in Snakerec) { paper.FillRectangle(Brush, rec); } } catch (Exception ex) { string st = ex.Message; } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)