Isse Kun
Emektar Üye
Bu dersimizde sizlere forma şekil çizmeyi göstereceğim.
Formumuza 1 button ekleyelim. Button'un click olayına aşağıdaki kodu yazalım;
Kod:
private void button1_Click(object sender, System.EventArgs e)
{
int mx, my, i;
Graphics g;
Random r = new Random();
mx = r.Next(Width);
my = r.Next(Height / 2);
g = this.CreateGraphics();
for (i = 1 ; i<= 10 ; i++)
g.DrawRectangle(new Pen(Color.Blue, i),
mx - i * 10,my - i * 10,
i * 20, i * 20);
g.Dispose();
}
Formumuza 1 button ekleyelim. Button'un click olayına aşağıdaki kodu yazalım;
Kod:
private void button1_Click(object sender, System.EventArgs e)
{
int mx, my, i;
Graphics g;
Random r = new Random();
mx = r.Next(Width);
my = r.Next(Height / 2);
g = this.CreateGraphics();
for (i = 1 ; i<= 10 ; i++)
g.DrawRectangle(new Pen(Color.Blue, i),
mx - i * 10,my - i * 10,
i * 20, i * 20);
g.Dispose();
}