/// <summary>
        /// Simply grab a 1*1 pixel from the current color image, and
        /// use that and copy the new 1*1 image pixels to a byte array and
        /// then construct a Color from that.
        /// </summary>
        private void CanvImage_MouseMove(object sender, MouseEventArgs e)
        {
            if (!IsMouseDown)
            {
                return;
            }

            try
            {
                CroppedBitmap cb = new CroppedBitmap(ColorImage.Source as BitmapSource,
                                                     new Int32Rect((int)Mouse.GetPosition(CanvImage).X,
                                                                   (int)Mouse.GetPosition(CanvImage).Y, 1, 1));

                byte[] pixels = new byte[4];

                try
                {
                    cb.CopyPixels(pixels, 4, 0);
                }
                catch (Exception)
                {
                    //Ooops
                }

                //Ok now, so update the mouse cursor position and the SelectedColor
                ellipsePixel.SetValue(Canvas.LeftProperty, (double)(Mouse.GetPosition(CanvImage).X - 5));
                ellipsePixel.SetValue(Canvas.TopProperty, (double)(Mouse.GetPosition(CanvImage).Y - 5));
                CanvImage.InvalidateVisual();
                SelectedColor = Color.FromArgb((byte)AlphaSlider.Value, pixels[2], pixels[1], pixels[0]);
            }
            catch (Exception)
            {
                //not much we can do
            }
        }
        private void CanvasPanel_MouseMove(object sender, MouseEventArgs e)
        {
            if (!isMouseDown)
            {
                return;
            }
            else if (Mouse.GetPosition(CanvasPanel).X < 5 || Mouse.GetPosition(CanvasPanel).X > 165 ||
                     Mouse.GetPosition(CanvasPanel).Y < 5 || Mouse.GetPosition(CanvasPanel).Y > 165)
            {
                isMouseDown = false;
            }
            else if (Mouse.GetPosition(CanvImage).X < CanvImage.Width && Mouse.GetPosition(CanvImage).X >= 0 &&
                     Mouse.GetPosition(CanvImage).Y < CanvImage.Height && Mouse.GetPosition(CanvImage).Y >= 0)
            {
                CroppedBitmap cb = new CroppedBitmap(ColorImage.Source as BitmapSource,
                                                     new Int32Rect((int)Mouse.GetPosition(CanvImage).X,
                                                                   (int)Mouse.GetPosition(CanvImage).Y, 1, 1));

                byte[] pixels = new byte[4];
                cb.CopyPixels(pixels, 4, 0);
                MoveEllipse(Mouse.GetPosition(CanvImage).X, Mouse.GetPosition(CanvImage).Y, Color.FromArgb(255, pixels[2], pixels[1], pixels[0]));
                CanvImage.InvalidateVisual();

                SelectedColor = Color.FromArgb(255, pixels[2], pixels[1], pixels[0]);
                UpdateTextBox();
            }
        }