CPDFFontControl.xaml.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. CPDFFontUI.FontFamilyChanged += CPDFFontUI_FontFamilyChanged;
  47. CPDFFontUI.FontStyleChanged += CPDFFontUI_FontStyleChanged;
  48. CPDFFontUI.FontSizeChanged += CPDFFontUI_FontSizeChanged;
  49. CPDFFontUI.FontAlignChanged += CPDFFontUI_FontAlignChanged;
  50. }
  51. private void CPDFFontUI_FontAlignChanged(object sender, EventArgs e)
  52. {
  53. FontAlignChanged?.Invoke(this, EventArgs.Empty);
  54. }
  55. private void CPDFFontUI_FontSizeChanged(object sender, EventArgs e)
  56. {
  57. FontSizeChanged?.Invoke(this, EventArgs.Empty);
  58. }
  59. private void CPDFFontUI_FontStyleChanged(object sender, EventArgs e)
  60. {
  61. FontStyleChanged?.Invoke(this, EventArgs.Empty);
  62. }
  63. private void CPDFFontUI_FontFamilyChanged(object sender, EventArgs e)
  64. {
  65. FontFamilyChanged?.Invoke(this, EventArgs.Empty);
  66. }
  67. }
  68. }