Пример #1
0
 private void drawingCanvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     Point mouseLocation = e.GetPosition(this.drawingCanvas);
     Square mySquare = new Square(100);
     if (mySquare is IDraw) {
         IDraw drawSquare = mySquare;
         drawSquare.SetLocation((int)mouseLocation.X, (int)mouseLocation.Y);
         drawSquare.Draw(this.drawingCanvas);
     }
     if (mySquare is IColor) {
         IColor colorSquare = mySquare;
         colorSquare.SetColor(Colors.BlueViolet);
     }
 }
Пример #2
0
        private void drawingCanvas_Tapped(object sender, TappedRoutedEventArgs e)
        {
            Point mouseLocation = e.GetPosition(this.drawingCanvas);
            Square mySquare = new Square(100);

            if (mySquare is IDraw)
            {
                IDraw drawSquare = mySquare;
                drawSquare.X = (int)mouseLocation.X;
                drawSquare.Y = (int)mouseLocation.Y;
                drawSquare.Draw(drawingCanvas);
            }

            if (mySquare is IColor)
            {
                IColor colorSquare = mySquare;
                colorSquare.Color = Colors.BlueViolet;
            }
        }