星火微课系统客户端
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

EllipseTool.cs 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System.Windows;
  2. using System.Windows.Controls;
  3. using System.Windows.Media;
  4. namespace ComeCapture.Controls
  5. {
  6. public class EllipseTool : StackPanel
  7. {
  8. static EllipseTool()
  9. {
  10. DefaultStyleKeyProperty.OverrideMetadata(typeof(EllipseTool), new FrameworkPropertyMetadata(typeof(EllipseTool)));
  11. }
  12. public EllipseTool()
  13. {
  14. _Current = this;
  15. }
  16. #region 属性 Current
  17. private static EllipseTool _Current = null;
  18. public static EllipseTool Current => _Current;
  19. #endregion 属性 Current
  20. #region LineThickness DependencyProperty
  21. public double LineThickness
  22. {
  23. get => (double)GetValue(LineThicknessProperty);
  24. set => SetValue(LineThicknessProperty, value);
  25. }
  26. public static readonly DependencyProperty LineThicknessProperty =
  27. DependencyProperty.Register("LineThickness", typeof(double), typeof(EllipseTool),
  28. new PropertyMetadata(5.0, new PropertyChangedCallback(EllipseTool.OnLineThicknessPropertyChanged)));
  29. private static void OnLineThicknessPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
  30. {
  31. if (obj is EllipseTool)
  32. {
  33. (obj as EllipseTool).OnLineThicknessValueChanged();
  34. }
  35. }
  36. protected void OnLineThicknessValueChanged()
  37. {
  38. }
  39. #endregion LineThickness DependencyProperty
  40. #region LineBrush DependencyProperty
  41. public SolidColorBrush LineBrush
  42. {
  43. get => (SolidColorBrush)GetValue(LineBrushProperty);
  44. set => SetValue(LineBrushProperty, value);
  45. }
  46. public static readonly DependencyProperty LineBrushProperty =
  47. DependencyProperty.Register("LineBrush", typeof(SolidColorBrush), typeof(EllipseTool),
  48. new PropertyMetadata(new SolidColorBrush(Colors.Red), new PropertyChangedCallback(EllipseTool.OnLineBrushPropertyChanged)));
  49. private static void OnLineBrushPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
  50. {
  51. if (obj is EllipseTool)
  52. {
  53. (obj as EllipseTool).OnLineBrushValueChanged();
  54. }
  55. }
  56. protected void OnLineBrushValueChanged()
  57. {
  58. }
  59. #endregion LineBrush DependencyProperty
  60. }
  61. }