CPDFFontControl.xaml.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. using Compdfkit_Tools.Data;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. namespace Compdfkit_Tools.Common
  17. {
  18. /// <summary>
  19. /// CPDFFontControl.xaml 的交互逻辑
  20. /// </summary>
  21. public partial class CPDFFontControl : UserControl
  22. {
  23. public bool IsReset = false;
  24. private int _fontSizeValue = 20;
  25. public int FontSizeValue
  26. {
  27. get => CPDFFontUI.FontSizeValue;
  28. set => CPDFFontUI.FontSizeValue = value;
  29. }
  30. public string FontFamilyValue
  31. {
  32. get => CPDFFontUI.FontFamilyValue;
  33. set => CPDFFontUI.FontFamilyValue = value;
  34. }
  35. public bool IsBold
  36. {
  37. get => CPDFFontUI.IsBold;
  38. set => CPDFFontUI.IsBold = value;
  39. }
  40. public bool IsItalic
  41. {
  42. get => CPDFFontUI.IsItalic;
  43. set => CPDFFontUI.IsItalic = value;
  44. }
  45. public TextAlignment TextAlignment
  46. {
  47. get => CPDFFontUI.TextAlignment;
  48. set => CPDFFontUI.TextAlignment = value;
  49. }
  50. public event EventHandler FontFamilyChanged;
  51. public event EventHandler FontStyleChanged;
  52. public event EventHandler FontSizeChanged;
  53. public event EventHandler FontAlignChanged;
  54. public CPDFFontControl()
  55. {
  56. InitializeComponent();
  57. CPDFFontUI.FontFamilyChanged += CPDFFontUI_FontFamilyChanged;
  58. CPDFFontUI.FontStyleChanged += CPDFFontUI_FontStyleChanged;
  59. CPDFFontUI.FontSizeChanged += CPDFFontUI_FontSizeChanged;
  60. CPDFFontUI.FontAlignChanged += CPDFFontUI_FontAlignChanged;
  61. }
  62. private void CPDFFontUI_FontAlignChanged(object sender, EventArgs e)
  63. {
  64. FontAlignChanged?.Invoke(this, EventArgs.Empty);
  65. }
  66. private void CPDFFontUI_FontSizeChanged(object sender, EventArgs e)
  67. {
  68. FontSizeChanged?.Invoke(this, EventArgs.Empty);
  69. }
  70. private void CPDFFontUI_FontStyleChanged(object sender, EventArgs e)
  71. {
  72. FontStyleChanged?.Invoke(this, EventArgs.Empty);
  73. }
  74. private void CPDFFontUI_FontFamilyChanged(object sender, EventArgs e)
  75. {
  76. FontFamilyChanged?.Invoke(this, EventArgs.Empty);
  77. }
  78. }
  79. }