CPDFFontControl.xaml.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using System;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. namespace Compdfkit_Tools.Common
  5. {
  6. public partial class CPDFFontControl : UserControl
  7. {
  8. public bool IsReset = false;
  9. private int _fontSizeValue = 20;
  10. public int FontSizeValue
  11. {
  12. get => CPDFFontUI.FontSizeValue;
  13. set => CPDFFontUI.FontSizeValue = value;
  14. }
  15. public string FontFamilyValue
  16. {
  17. get => CPDFFontUI.FontFamilyValue;
  18. set => CPDFFontUI.FontFamilyValue = value;
  19. }
  20. public bool IsBold
  21. {
  22. get => CPDFFontUI.IsBold;
  23. set => CPDFFontUI.IsBold = value;
  24. }
  25. public bool IsItalic
  26. {
  27. get => CPDFFontUI.IsItalic;
  28. set => CPDFFontUI.IsItalic = value;
  29. }
  30. public TextAlignment TextAlignment
  31. {
  32. get => CPDFFontUI.TextAlignment;
  33. set => CPDFFontUI.TextAlignment = value;
  34. }
  35. public event EventHandler FontFamilyChanged;
  36. public event EventHandler FontStyleChanged;
  37. public event EventHandler FontSizeChanged;
  38. public event EventHandler FontAlignChanged;
  39. public CPDFFontControl()
  40. {
  41. InitializeComponent();
  42. CPDFFontUI.FontFamilyChanged += CPDFFontUI_FontFamilyChanged;
  43. CPDFFontUI.FontStyleChanged += CPDFFontUI_FontStyleChanged;
  44. CPDFFontUI.FontSizeChanged += CPDFFontUI_FontSizeChanged;
  45. CPDFFontUI.FontAlignChanged += CPDFFontUI_FontAlignChanged;
  46. }
  47. private void CPDFFontUI_FontAlignChanged(object sender, EventArgs e)
  48. {
  49. FontAlignChanged?.Invoke(this, EventArgs.Empty);
  50. }
  51. private void CPDFFontUI_FontSizeChanged(object sender, EventArgs e)
  52. {
  53. FontSizeChanged?.Invoke(this, EventArgs.Empty);
  54. }
  55. private void CPDFFontUI_FontStyleChanged(object sender, EventArgs e)
  56. {
  57. FontStyleChanged?.Invoke(this, EventArgs.Empty);
  58. }
  59. private void CPDFFontUI_FontFamilyChanged(object sender, EventArgs e)
  60. {
  61. FontFamilyChanged?.Invoke(this, EventArgs.Empty);
  62. }
  63. }
  64. }