FreeTextParam.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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;
  13. set; }
  14. public byte[] BgColor { get; set; }
  15. public bool HasBgColor { get; set; }
  16. public byte[] FontColor { get; set; }
  17. public double LineWidth { get; set; }
  18. public bool IsBold { get; set; }
  19. public bool IsItalic { get; set; }
  20. public string FontName { get; set; } = string.Empty;
  21. public double FontSize { get; set; }
  22. public C_TEXT_ALIGNMENT Alignment { get; set; }
  23. public float[] Dash { get; set; }
  24. public override bool CopyTo(AnnotParam transfer)
  25. {
  26. FreeTextParam freetextTransfer = transfer as FreeTextParam;
  27. if (freetextTransfer == null)
  28. {
  29. return false;
  30. }
  31. if (!base.CopyTo(freetextTransfer))
  32. {
  33. return false;
  34. }
  35. if(LineColor != null)
  36. {
  37. freetextTransfer.LineColor = (byte[])LineColor.Clone();
  38. }
  39. if(BgColor != null)
  40. {
  41. freetextTransfer.BgColor = (byte[])BgColor.Clone();
  42. }
  43. if(FontColor != null)
  44. {
  45. freetextTransfer.FontColor = (byte[])FontColor.Clone();
  46. }
  47. freetextTransfer.Dash = null;
  48. if (Dash != null)
  49. {
  50. float[] DashCopy = new float[Dash.Length];
  51. Dash.CopyTo(DashCopy, 0);
  52. freetextTransfer.Dash = DashCopy;
  53. }
  54. freetextTransfer.HasBgColor = HasBgColor;
  55. freetextTransfer.LineWidth = LineWidth;
  56. freetextTransfer.IsBold = IsBold;
  57. freetextTransfer.IsItalic = IsItalic;
  58. freetextTransfer.FontName = FontName;
  59. freetextTransfer.FontSize = FontSize;
  60. freetextTransfer.Alignment = Alignment;
  61. return true;
  62. }
  63. }
  64. }