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 zaj4
{
public partial class Form1 : Form
{
int R = 0, G = 0, B = 0;
int figura;
Random rnd = new Random();
Timer czas = new Timer();
public Form1()
{
InitializeComponent();
DoubleBuffered = true;
}
private void button1_Click(object sender, EventArgs e)
{
figura = 1;
this.Invalidate();
//Graphics formGraphics = this.CreateGraphics();
// int j = 0;
// int k = 0;
// for (int i = 0; i < 100; i++)
// {
// if (j == 10)
// {
// k++;
// j = 0;
// }
// R = rnd.Next(0, 255);
// G = rnd.Next(0, 255);
// B = rnd.Next(0, 255);
// System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(Color.FromArgb(R, G, B));
// formGraphics.FillRectangle(myBrush, new Rectangle(new Point(10 + 30 * j, 120 + 30 * k), new Size(25, 25)));
// j++;
// }
}
private void button2_Click(object sender, EventArgs e)
{
figura = 2;
this.Invalidate();
}
private void button3_Click(object sender, EventArgs e)
{
figura = 3;
this.Invalidate();
}
private void button4_Click(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics formGraphics = this.CreateGraphics();
int j = 0;
int k = 0;
for (int i = 0; i < 100; i++)
{
if (j == 10)
{
k++;
j = 0;
}
R = rnd.Next(0, 255);
G = rnd.Next(0, 255);
B = rnd.Next(0, 255);
switch (figura)
{
case 1:
{
System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(Color.FromArgb(R, G, B));
formGraphics.FillRectangle(myBrush, new Rectangle(new Point(10 + 30 * j, 120 + 30 * k), new Size(25, 25)));
j++;
}
break;
case 2:
{
Point[] p = new Point[3];
p[0] = new Point(10 + 30 * j, 140 + 30 * k);
p[1] = new Point(30 + 30 * j, 140 + 30 * k);
p[2] = new Point(20 + 30 * j, 120 + 30 * k);
formGraphics.FillPolygon(Brushes.Fuchsia, p);
System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(Color.FromArgb(R, G, B));
formGraphics.FillPolygon(myBrush, p);
j++;
}
break;
case 3:
{
System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(Color.FromArgb(R, G, B));
formGraphics.FillEllipse(myBrush, new Rectangle(new Point(10 + 30 * j, 120 + 30 * k), new Size(25, 25)));
j++;
}
break;
}
}
}
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}