/// <summary> /// Перерисовка объектов /// </summary> private void Ref() { Pen p; if (fl) { list = inst.Add1; list2 = (Paint.Pryam)inst.Add2; list3 = (Paint.Pryam)inst.Add3; } if (list.Count != 0) { Element1 t = list.Head; for (int i = 0; i < list.Count; i++) { Color col = Color.FromArgb(t.Col); p = new Pen(col, t.T); p.StartCap = LineCap.Round; p.EndCap = LineCap.Round; p.LineJoin = LineJoin.Round; g.SmoothingMode = SmoothingMode.AntiAlias; g.DrawLine(p, t.X, t.Y); t = t.Next; } } if (list2.Count != 0) { Element1 t = list2.Head; for (int i = 0; i < list2.Count; i++) { Color col = Color.FromArgb(t.Col); p = new Pen(col, t.T); g.DrawRectangle(p, t.X.X, t.X.Y, t.Y.X - t.X.X, t.Y.Y - t.X.Y); t = t.Next; } } if (list3.Count != 0) { Element1 t = list3.Head; for (int i = 0; i < list3.Count; i++) { Color col = Color.FromArgb(t.Col); p = new Pen(col, t.T); g.DrawEllipse(p, t.X.X, t.X.Y, t.Y.X - t.X.X, t.Y.Y - t.X.Y); t = t.Next; } } }
/// <summary> /// Добавление элемента /// </summary> /// <param name="pen"></param> /// <param name="x"></param> /// <param name="y"></param> public virtual void Add(Color color, int v, Point x, Point y) { Element1 tmp = new Element1(color, v, x, y); if (Head == null) { Head = tmp; Head.Next = null; } else { Element1 t = Head; while (t.Next != null) { t = t.Next; } t.Next = tmp; } }
/// <summary> /// Удаление всех элементов /// </summary> public virtual void Clear() { Head = null; }