public void Do() { savepreviouspixel(); rectangle r = new rectangle(_fromX, _fromY, _p, _sb, _toX, _toY, _objGraphic); r.draw(); }
private void panel1_MouseUp(object sender, MouseEventArgs e) { if (shouldPaint == true) { if (line == true) { line l = new line(initialX, initialY, p, e.X, e.Y, objGraphic, 3); borderColorDecorator f = new borderColorDecorator(l, Color.Pink); f.draw(); //rumusline(); } else if (rectang == true) { // width = e.X - initialX; // height = e.Y - initialY; rectangle r = new rectangle(initialX, initialY, p, e.X, e.Y, objGraphic, 3); //decorator b = new decorator(r); fillColorDecorator b = new fillColorDecorator(r, Color.Aqua); borderColorDecorator f = new borderColorDecorator(r, Color.Pink); b.draw(); f.draw(); //rumusrectang(); } else if (circle == true) { circle r = new circle(initialX, initialY, p, e.X, e.Y, objGraphic, 3); //cirW = Math.Abs(e.X - initialX); //cirL = Math.Abs(e.Y - initialY); fillColorDecorator b = new fillColorDecorator(r, Color.Aqua); borderColorDecorator f = new borderColorDecorator(r, Color.Pink); b.draw(); f.draw(); //cir.draw(p, e.X, e.Y, objGraphic); } shouldPaint = false; /*else if (trangle == true) * { * if (triangle_step == false) * { * newCoor = new Point(e.X, e.Y); * objGraphic.DrawLine(p, preCoor, newCoor); * rumusline(); * triangle_step = true; * } * if(triangle_step == true) * { * Point newCoorgain = new Point (e.X, e.Y); * objGraphic.DrawLine(p, preCoor, newCoorgain); * objGraphic.DrawLine(p, preCoor, newCoor); * } * shouldPaint = false; * objGraphic.DrawPolygon(p, list); * rumustriangle(); shouldPaint = false; * }*/ } }