C# Drawing

Apr 25 2012 6:41 AM
HI Guys,

Im trying to add two convos boxes to my program to replace the current buttons i have. One to allow the user to select a colour for the ellipse and a Second which allows the user to draw a rectangle or square on the canvas. So if anyone's willing to have ago at helping me by editing my code I would be very greatful. 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;



namespace WPFDraw
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        bool paint;
        int toolSelected;

        public MainWindow()
        {
            InitializeComponent();
            paint = false;
            toolSelected = 0;
        }

        private void canvas1_MouseDown(object sender, MouseButtonEventArgs e)
        {
            paint = true;
        }


        private void canvas1_MouseUp(object sender, MouseButtonEventArgs e)
        {
            paint = false;
        }

        private void canvas1_MouseMove(object sender, MouseEventArgs e)
        {
            Point p;
            p = e.GetPosition(canvas1);

            if (paint == true)
            {
                if (toolSelected == 0)
                {
                    Ellipse myEllipse = new Ellipse();
                    myEllipse.Fill = Brushes.Green;
                    myEllipse.Width = 30;
                    myEllipse.Height = 55;
                    myEllipse.Margin = new Thickness(p.X, p.Y, 0, 0);

                    canvas1.Children.Add(myEllipse);
                }


                 else if (toolSelected == 1)
                {
                    Ellipse myEllipse = new Ellipse();
                    myEllipse.Fill = Brushes.Red;
                    myEllipse.Width = 30;
                    myEllipse.Height = 55;
                    myEllipse.Margin = new Thickness(p.X, p.Y, 0, 0);
                    

                    canvas1.Children.Add(myEllipse);
                }


                 if  (toolSelected == 2)
                {
                    Ellipse myEllipse = new Ellipse();
                    myEllipse.Fill = Brushes.Blue;
                    myEllipse.Width = 30;
                    myEllipse.Height = 55;
                    myEllipse.Margin = new Thickness(p.X, p.Y, 0, 0);

                    canvas1.Children.Add(myEllipse);
                }
            }
        }


        



        private void buttonEllipse_Click(object sender, RoutedEventArgs e)
        {
            toolSelected = 0;
        }

        private void buttonEllipseRed_Click(object sender, RoutedEventArgs e)
        {
            toolSelected = 1;
        }

        private void buttonEllipseBlue_Click(object sender, RoutedEventArgs e)
        {
            toolSelected = 2;
        }


        // Event handler, that closes the program.

        private void CloseButton_Click(object sender, RoutedEventArgs e)
        {
            Close();
        }


        // Event handler, that restarts the program from the beginning.

        private void RestartButton_Click(object sender, RoutedEventArgs e)
        {
            System.Diagnostics.Process.Start(Application.ResourceAssembly.Location);
            Application.Current.Shutdown();
        }



        private void saveImage_Click(object sender, RoutedEventArgs e)
        {

        }

       


}
    
}



   
      PLEASE REMEMBER I NEED TO USE C# WPF