FreeTextParam.cs 2.2 KB

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