FreeTextParam.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using ComPDFKit.PDFAnnotation;
  2. using System.Windows;
  3. using System.Windows.Media;
  4. namespace ComPDFKit.Tool
  5. {
  6. public class FreeTextParam:AnnotParam
  7. {
  8. public FreeTextParam ()
  9. {
  10. CurrentType = C_ANNOTATION_TYPE.C_ANNOTATION_FREETEXT;
  11. }
  12. public byte[] LineColor { get; set; }
  13. public byte[] BgColor { get; set; }
  14. public bool HasBgColor { get; set; }
  15. public byte[] FontColor { get; set; }
  16. public double LineWidth { get; set; }
  17. public bool IsBold { get; set; }
  18. public bool IsItalic { get; set; }
  19. public string FontName { get; set; } = string.Empty;
  20. public double FontSize { get; set; }
  21. public C_TEXT_ALIGNMENT Alignment { get; set; }
  22. public override bool CopyTo(AnnotParam transfer)
  23. {
  24. FreeTextParam freetextTransfer = transfer as FreeTextParam;
  25. if (freetextTransfer == null)
  26. {
  27. return false;
  28. }
  29. if (!base.CopyTo(freetextTransfer))
  30. {
  31. return false;
  32. }
  33. if(LineColor != null)
  34. {
  35. freetextTransfer.LineColor = (byte[])LineColor.Clone();
  36. }
  37. if(BgColor != null)
  38. {
  39. freetextTransfer.BgColor = (byte[])BgColor.Clone();
  40. }
  41. if(FontColor != null)
  42. {
  43. freetextTransfer.FontColor = (byte[])FontColor.Clone();
  44. }
  45. freetextTransfer.HasBgColor = HasBgColor;
  46. freetextTransfer.LineWidth = LineWidth;
  47. freetextTransfer.IsBold = IsBold;
  48. freetextTransfer.IsItalic = IsItalic;
  49. freetextTransfer.FontName = FontName;
  50. freetextTransfer.FontSize = FontSize;
  51. freetextTransfer.Alignment = Alignment;
  52. return true;
  53. }
  54. }
  55. }