Уважаемые программисты, помогите пожалуйста защитить курсовую работу. Нужно рассказать в какой строчке запускается программа программа, где происходит создание и координаты окна, где происходит добавление графического элемента, где строчка что каждый последующий элемент имеет случайные формы, размер, цвет. Где происходит удаление графического элемента, где строчка которая отвечает за то что именно последний элемент будет удален. Как то так, листинг кода могу в личку скинуть, или лучше сюда? Не протеворечит ли это правилам?)
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 metal
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public const int MAX_SIZE = 100;
dStack stack = new dStack(true);
grFigure tmp = null;
private void Form1_Paint(object sender, PaintEventArgs e)
{
int x, y, i = 0, j = 0;
dStack curr;
curr = stack;
while(curr.value != null)
{
x = i * MAX_SIZE + (MAX_SIZE - curr.value.fA) / 2;
y = j * MAX_SIZE + (MAX_SIZE - curr.value.fA) / 2;
curr.value.draw(x, y, e);
if (curr.next == null)
{
e.Graphics.DrawString("sp", Form1.DefaultFont,
Brushes.Red, x, (j + 1) * MAX_SIZE - 5);
break;
}
else
{
curr = curr.next;
}
i++;
if (i == 4) { i = 0; j++; }
}
}
class grFigure
{
public int fA;
public int ftype;
public Color fclr;
private Random rnd = new Random();
public grFigure()
{
fA = rnd.Next(20, MAX_SIZE);
ftype = rnd.Next(0, 3);
fclr = getColor(rnd.Next(0, 6));
}
public void draw(int x, int y, PaintEventArgs e)
{
switch (ftype)
{
case 0:
e.Graphics.DrawEllipse(new Pen(fclr, 3), x, y, fA, fA);
break;
case 1:
e.Graphics.DrawRectangle(new Pen(fclr, 3), x, y, fA, fA);
break;
case 2:
e.Graphics.DrawLine(new Pen(fclr, 3),
new Point(x + fA / 2, y),
new Point(x, y + fA));
e.Graphics.DrawLine(new Pen(fclr, 3),
new Point(x + fA / 2, y),
new Point(x + fA, y + fA));
e.Graphics.DrawLine(new Pen(fclr, 3),
new Point(x, y + fA),
new Point(x + fA, y + fA));
break;
}
}
private Color getColor(int n)
{
Color tmp = new Color();
switch (n)
{
case 0: tmp = Color.Red; break;
case 1: tmp = Color.Blue; break;
case 2: tmp = Color.Green; break;
case 3: tmp = Color.Yellow; break;
case 4: tmp = Color.Orange; break;
case 5: tmp = Color.Pink; break;
case 6: tmp = Color.Cyan; break;
}
return tmp;
}
}
class dStack
{
public grFigure value;
public dStack next;
private bool _main;
public dStack(bool isMain)
{
value = null;
next = null;
_main = isMain;
}
"удаление" похоже все-таки в этой строчкеif (value != null) { t = value; value = null; return t; }, а именно value = null; . Я бы сказал "обнуление". А удаление объекта я так понимаю вот тут происходит: stack.Delete();