CustomDrawing.xaml.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. using Avalonia.Controls;
  3. using Avalonia.Interactivity;
  4. namespace ControlCatalog.Pages
  5. {
  6. public partial class CustomDrawing : UserControl
  7. {
  8. public CustomDrawing()
  9. {
  10. InitializeComponent();
  11. }
  12. private void RotateMinus(object? sender, RoutedEventArgs e)
  13. {
  14. CustomDrawingControl.Rotation -= Math.PI / 20.0d;
  15. }
  16. private void RotatePlus(object? sender, RoutedEventArgs e)
  17. {
  18. if (CustomDrawingControl is null)
  19. return;
  20. CustomDrawingControl.Rotation += Math.PI / 20.0d;
  21. }
  22. private void ZoomIn(object? sender, RoutedEventArgs e)
  23. {
  24. if (CustomDrawingControl is null)
  25. return;
  26. CustomDrawingControl.Scale *= 1.2d;
  27. }
  28. private void ZoomOut(object? sender, RoutedEventArgs e)
  29. {
  30. if (CustomDrawingControl is null)
  31. return;
  32. CustomDrawingControl.Scale /= 1.2d;
  33. }
  34. }
  35. }