ScaleRule.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace GUI
  11. {
  12. public partial class ScaleRule : UserControl
  13. {
  14. float degree;
  15. public float Degree
  16. {
  17. get => degree;
  18. set
  19. {
  20. value = Math.Abs(value % 360);
  21. if (value > 174)
  22. {
  23. float t = value - 174;
  24. float v = -t * 1.542f;
  25. ScalePane.Location = new Point((int)v, 0);
  26. }
  27. else
  28. {
  29. float t = 174 - value;
  30. float v = t * 1.542f - 554f;
  31. ScalePane.Location = new Point((int)v, 0);
  32. }
  33. degree = value;
  34. }
  35. }
  36. public ScaleRule()
  37. {
  38. InitializeComponent();
  39. Degree = 0;
  40. }
  41. }
  42. }