WidgetParm.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using ComPDFKit.PDFAnnotation;
  2. using ComPDFKit.PDFAnnotation.Form;
  3. using System.Windows.Media;
  4. namespace ComPDFKit.Tool
  5. {
  6. public class WidgetParm:AnnotParam
  7. {
  8. public C_WIDGET_TYPE WidgetType { get; set; }
  9. public C_BORDER_STYLE BorderStyle { get; set; }
  10. public byte[] LineColor { get; set; }
  11. public bool HasLineColor { get; set; }
  12. public byte[] BgColor { get; set; }
  13. public bool HasBgColor { get; set; }
  14. public byte[] FontColor { get; set; }
  15. public string FontName { get; set; } = string.Empty;
  16. public double FontSize { get; set; }
  17. public double LineWidth { get; set; }
  18. public string FieldName { get; set; } = string.Empty;
  19. /// <summary>
  20. /// Note the use of ParamConverter.GetFormFlags for obtaining the result
  21. /// </summary>
  22. public int Flags { get; set; }
  23. public bool IsReadOnly { get; set; }
  24. public bool IsHidden { get; set; }
  25. public override bool CopyTo(AnnotParam transfer)
  26. {
  27. WidgetParm formTransfer = transfer as WidgetParm;
  28. if (formTransfer == null)
  29. {
  30. return false;
  31. }
  32. if (!base.CopyTo(formTransfer))
  33. {
  34. return false;
  35. }
  36. formTransfer.WidgetType = WidgetType;
  37. formTransfer.BorderStyle = BorderStyle;
  38. if(LineColor!=null)
  39. {
  40. formTransfer.LineColor = (byte[])LineColor.Clone();
  41. }
  42. if(BgColor!=null)
  43. {
  44. formTransfer.BgColor = (byte[])BgColor.Clone();
  45. }
  46. if(FontColor!=null)
  47. {
  48. formTransfer.FontColor = (byte[])FontColor.Clone();
  49. }
  50. formTransfer.HasBgColor = HasBgColor;
  51. formTransfer.HasLineColor = HasLineColor;
  52. formTransfer.LineWidth = LineWidth;
  53. formTransfer.FieldName = FieldName;
  54. formTransfer.FontName = FontName;
  55. formTransfer.FontSize = FontSize;
  56. formTransfer.Flags = Flags;
  57. formTransfer.IsReadOnly = IsReadOnly;
  58. formTransfer.IsHidden = IsHidden;
  59. return true;
  60. }
  61. }
  62. }