Arc.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System.Windows;
  2. using System.Windows.Media;
  3. using HandyControl.Expression.Media;
  4. namespace HandyControl.Expression.Shapes;
  5. public sealed class Arc : PrimitiveShape, IArcGeometrySourceParameters
  6. {
  7. public static readonly DependencyProperty ArcThicknessProperty =
  8. DependencyProperty.Register("ArcThickness", typeof(double), typeof(Arc),
  9. new DrawingPropertyMetadata(0.0, DrawingPropertyMetadataOptions.AffectsRender));
  10. public static readonly DependencyProperty ArcThicknessUnitProperty =
  11. DependencyProperty.Register("ArcThicknessUnit", typeof(UnitType), typeof(Arc),
  12. new DrawingPropertyMetadata(UnitType.Pixel, DrawingPropertyMetadataOptions.AffectsRender));
  13. public static readonly DependencyProperty EndAngleProperty = DependencyProperty.Register("EndAngle",
  14. typeof(double), typeof(Arc),
  15. new DrawingPropertyMetadata(90.0, DrawingPropertyMetadataOptions.AffectsRender));
  16. public static readonly DependencyProperty StartAngleProperty =
  17. DependencyProperty.Register("StartAngle", typeof(double), typeof(Arc),
  18. new DrawingPropertyMetadata(0.0, DrawingPropertyMetadataOptions.AffectsRender));
  19. public double ArcThickness
  20. {
  21. get => (double) GetValue(ArcThicknessProperty);
  22. set => SetValue(ArcThicknessProperty, value);
  23. }
  24. public UnitType ArcThicknessUnit
  25. {
  26. get => (UnitType) GetValue(ArcThicknessUnitProperty);
  27. set => SetValue(ArcThicknessUnitProperty, value);
  28. }
  29. public double EndAngle
  30. {
  31. get => (double) GetValue(EndAngleProperty);
  32. set => SetValue(EndAngleProperty, value);
  33. }
  34. Stretch IGeometrySourceParameters.Stretch => Stretch;
  35. Brush IGeometrySourceParameters.Stroke => Stroke;
  36. double IGeometrySourceParameters.StrokeThickness => StrokeThickness;
  37. public double StartAngle
  38. {
  39. get => (double) GetValue(StartAngleProperty);
  40. set => SetValue(StartAngleProperty, value);
  41. }
  42. protected override IGeometrySource CreateGeometrySource()
  43. {
  44. return new ArcGeometrySource();
  45. }
  46. }