LastFormatting.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using System.Drawing;
  2. using FastReport.Utils;
  3. namespace FastReport.Design
  4. {
  5. internal class LastFormatting
  6. {
  7. private Border border;
  8. private FillBase fill;
  9. private Font font;
  10. private HorzAlign horzAlign;
  11. private VertAlign vertAlign;
  12. private FillBase textFill;
  13. private int angle;
  14. public Border Border
  15. {
  16. get { return border; }
  17. set { border = value; }
  18. }
  19. public FillBase Fill
  20. {
  21. get { return fill; }
  22. set { fill = value; }
  23. }
  24. public Font Font
  25. {
  26. get { return font; }
  27. set { font = value; }
  28. }
  29. public HorzAlign HorzAlign
  30. {
  31. get { return horzAlign; }
  32. set { horzAlign = value; }
  33. }
  34. public VertAlign VertAlign
  35. {
  36. get { return vertAlign; }
  37. set { vertAlign = value; }
  38. }
  39. public FillBase TextFill
  40. {
  41. get { return textFill; }
  42. set { textFill = value; }
  43. }
  44. public int Angle
  45. {
  46. get { return angle; }
  47. set { angle = value; }
  48. }
  49. public void SetFormatting(ReportComponentBase c)
  50. {
  51. if (Config.DisableLastFormatting)
  52. return;
  53. if (c != null)
  54. {
  55. if (Border != null && c.FlagUseBorder)
  56. c.Border = Border.Clone();
  57. if (c.FlagUseFill)
  58. c.Fill = Fill.Clone();
  59. }
  60. if (c is TextObject)
  61. {
  62. TextObject c1 = c as TextObject;
  63. if (Font != null)
  64. c1.Font = Font;
  65. c1.HorzAlign = HorzAlign;
  66. c1.VertAlign = VertAlign;
  67. c1.TextFill = TextFill.Clone();
  68. c1.Angle = Angle;
  69. }
  70. }
  71. public LastFormatting()
  72. {
  73. Border = new Border();
  74. Fill = new SolidFill();
  75. TextFill = new SolidFill(Color.Black);
  76. Font = Config.DesignerSettings.DefaultFont;
  77. }
  78. }
  79. }