private void constantObjectColorPictureBox_Click(object sender, EventArgs e)
 {
     if (colorDialog1.ShowDialog() == DialogResult.OK)
     {
         Color color = colorDialog1.Color;
         (sender as PictureBox).BackColor = color;
         if (ConstantObjectRadioButton.Checked)
         {
             PaintingManager.SetBaseObject(color);
             this.DrawNewPicture();
         }
     }
 }
        private void CheckRadioButtonsAndDrawNewPicture()
        {
            PaintingManager.SetLightColor(lightSourceColorPictureBox.BackColor);

            if (ConstantObjectRadioButton.Checked)
            {
                PaintingManager.SetBaseObject(constantObjectColorPictureBox.BackColor);
            }
            else
            {
                PaintingManager.SetBaseObject(textureObjectPictureBox.Image as Bitmap);
            }

            if (constantNormalVectorRadioButton.Checked)
            {
                PaintingManager.SetNormalVector(new Vector3(0, 0, 1));
            }
            else
            {
                PaintingManager.SetNormalVector(textureVectorPictureBox.Image as Bitmap);
            }

            if (noDisorderRadioButton.Checked)
            {
                PaintingManager.SetDisorder(new Vector3(0, 0, 0));
            }
            else
            {
                PaintingManager.SetDisorder(textureDisoderPictureBox.Image as Bitmap, fDisorderTextbox.Text);
            }

            if (constantLightSourceVectorRadioButton.Checked)
            {
                timer.Stop();
                PaintingManager.SetLightVector(new Vector3(0, 0, 1), true);
            }
            else
            {
                if (!int.TryParse(radiusLightSourceVectorTextBox.Text, out int radius))
                {
                    return;
                }
                PaintingManager.SetLightVector(new Vector3(radius, 0, 0), false);
                timer.Start();
            }

            PaintingManager.SetLights(redLightToolStripMenuItem.Checked, greenLightToolStripMenuItem.Checked, blueLightToolStripMenuItem.Checked);

            this.DrawNewPicture();
        }
 private void textureObjectPictureBox_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog dlg = new OpenFileDialog())
     {
         dlg.Title  = "Choose Texture Image";
         dlg.Filter = "Image Files|*.jpg;*.jpeg;*.png;*.bmp";
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             Bitmap image = new Bitmap(dlg.FileName);
             (sender as PictureBox).Image = image;
             if (TextureObjectRadioButton.Checked)
             {
                 PaintingManager.SetBaseObject(image);
                 this.DrawNewPicture();
             }
         }
     }
 }