private void Color_btn(object sender, EventArgs e) { if (_isBtnFillClicked) { settings.SetBrushColor(((Button)sender).BackColor); PictureBoxColorFillFigure.BackColor = ((Button)sender).BackColor; _isBtnFillClicked = false; if (_isFigureSelected) { drawingEngine.ChangeBrush(((Button)sender).BackColor); drawingEngine.SelectFigure(); } } else { settings.SetPenColor(((Button)sender).BackColor); PictureBoxColorFillFigure.BackColor = ((Button)sender).BackColor; PictureBoxThickness.Image = drawingEngine.GetPenImage(); if (_isFigureSelected) { drawingEngine.ChangePenColor(((Button)sender).BackColor); drawingEngine.SelectFigure(); } } PictureBoxPaint.Image = drawingEngine.MainImage; }