private void pictureBox1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right && buttonSwitch is FigureChangingButton == false) { currentColor = pictureBoxPrevColor.BackColor; } formCanvas.tmpBitmap = new Bitmap(formCanvas.currentBitmap); formCanvas.AddToTmp(); drawStartFinishFlag = buttonSwitch.ActivateButton(new Point(e.X, e.Y), pictureBox1, ref currentColor, ref currentPainter); if (drawStartFinishFlag) { currentPainter = currentFactory.CreatePainter(currentForm, currentColor, size, new Point(e.X, e.Y), currentFilling); //if (currentPainter.typeOfFilling is TotalFilling) //{ // currentPainter.typeOfFilling.fillingColor = currentColor; //} //else if (currentPainter.typeOfFilling is InsideFilling) //{ // currentPainter.typeOfFilling.fillingColor = pictureBoxPrevColor.BackColor; //} if (PointPolygonPainter.first.X != -1) { currentPainter.DrawDynamicFigure(new Point(e.X, e.Y), pictureBox1, shift); } } //fillingColor = pictureBoxPrevColor.BackColor; }