public static Shape GetRandomShape() { Shape shape = shapesArray[random.Next(shapesArray.Count)].Clone(); Image image = LoadImage.standartblocks[((ColorBlock)(random.Next(LoadImage.standartblocks.Count)))]; int count = 0; foreach (var i in shape.Blocks) { if (i == 1) { count++; } } shape.InitPictureBox(new PictureBox() { Image = new Bitmap(image), Visible = false, Width = Setting.blockSize, Height = Setting.blockSize }, count); return(shape); }