星火微课系统客户端
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System.Collections.Generic;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. using System.Windows.Media;
  5. namespace ComeCapture.Controls
  6. {
  7. public class TextTool : StackPanel
  8. {
  9. static TextTool()
  10. {
  11. DefaultStyleKeyProperty.OverrideMetadata(typeof(TextTool), new FrameworkPropertyMetadata(typeof(TextTool)));
  12. }
  13. public TextTool()
  14. {
  15. _Current = this;
  16. }
  17. #region 属性 Current
  18. private static TextTool _Current = null;
  19. public static TextTool Current => _Current;
  20. #endregion 属性 Current
  21. #region 属性 FontSizes
  22. private static Dictionary<int, int> _FontSizes;
  23. public static Dictionary<int, int> FontSizes
  24. {
  25. get
  26. {
  27. if (_FontSizes == null)
  28. {
  29. _FontSizes = new Dictionary<int, int>()
  30. {
  31. { 8,8},
  32. { 10,10},
  33. { 12,12},
  34. { 14,14},
  35. { 16,16},
  36. { 18,18},
  37. { 20,20},
  38. { 22,22}
  39. };
  40. }
  41. return _FontSizes;
  42. }
  43. set => _FontSizes = value;
  44. }
  45. #endregion 属性 FontSizes
  46. #region FontSize DependencyProperty
  47. public int FontSize
  48. {
  49. get => (int)GetValue(FontSizeProperty);
  50. set => SetValue(FontSizeProperty, value);
  51. }
  52. public static readonly DependencyProperty FontSizeProperty =
  53. DependencyProperty.Register("FontSize", typeof(int), typeof(TextTool),
  54. new PropertyMetadata(12, new PropertyChangedCallback(TextTool.OnFontSizePropertyChanged)));
  55. private static void OnFontSizePropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
  56. {
  57. if (obj is TextTool)
  58. {
  59. (obj as TextTool).OnFontSizeValueChanged();
  60. }
  61. }
  62. protected void OnFontSizeValueChanged()
  63. {
  64. }
  65. #endregion FontSize DependencyProperty
  66. #region LineBrush DependencyProperty
  67. public SolidColorBrush LineBrush
  68. {
  69. get => (SolidColorBrush)GetValue(LineBrushProperty);
  70. set => SetValue(LineBrushProperty, value);
  71. }
  72. public static readonly DependencyProperty LineBrushProperty =
  73. DependencyProperty.Register("LineBrush", typeof(SolidColorBrush), typeof(TextTool),
  74. new PropertyMetadata(new SolidColorBrush(Colors.Red), new PropertyChangedCallback(TextTool.OnLineBrushPropertyChanged)));
  75. private static void OnLineBrushPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
  76. {
  77. if (obj is TextTool)
  78. {
  79. (obj as TextTool).OnLineBrushValueChanged();
  80. }
  81. }
  82. protected void OnLineBrushValueChanged()
  83. {
  84. }
  85. #endregion LineBrush DependencyProperty
  86. }
  87. }