private void MouseTimer_Tick(object sender, EventArgs e) { Point curPos; if (_canvas.GetLastMouseLeftClick(out curPos) && _drawFlag == false) { _drawFlag = true; _lineStack.Push(new LinkedList <LineSeg>()); lastMousePos = curPos; } if (_canvas.GetLastMousePosition(out curPos) && _drawFlag == true) { LineSeg line = new LineSeg(lastMousePos, curPos, TrB_LineThick.Value, _color); totalLines += 1; _lineStack.Peek().AddLast(line); lastMousePos = curPos; line.Render(_canvas); } if (_canvas.GetLastMouseRightClick(out curPos) && _drawFlag == true) { _drawFlag = false; } UpdateInfo(); }
private void B_ReduceComplex_Click(object sender, EventArgs e) { LinkedListNode <LineSeg> scan = _lineStack.Peek().First; LineSeg fusedLine; if (_lineStack.Peek().Count >= 2) { while (scan != null && scan.Next != null) { fusedLine = new LineSeg(scan.Value.GetStart, scan.Next.Value.GetEnd, scan.Value.GetThickness, scan.Value.GetColor); scan.Value = fusedLine; _lineStack.Peek().Remove(scan.Next); scan = scan.Next; totalLines -= 1; } } Render(); }