TableColumnCollection.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Collections;
  5. using FastReport.Utils;
  6. namespace FastReport.Table
  7. {
  8. /// <summary>
  9. /// Represents a collection of <see cref="TableColumn"/> objects.
  10. /// </summary>
  11. public class TableColumnCollection : FRCollectionBase
  12. {
  13. /// <summary>
  14. /// Gets a column with specified index.
  15. /// </summary>
  16. /// <param name="index">Index of a column.</param>
  17. /// <returns>The column with specified index.</returns>
  18. public TableColumn this[int index]
  19. {
  20. get
  21. {
  22. TableColumn column = List[index] as TableColumn;
  23. column.SetIndex(index);
  24. return column;
  25. }
  26. }
  27. /// <inheritdoc/>
  28. protected override void OnInsert(int index, object value)
  29. {
  30. base.OnInsert(index, value);
  31. if (Owner != null)
  32. (Owner as TableBase).CorrectSpansOnColumnChange(index, 1);
  33. }
  34. /// <inheritdoc/>
  35. protected override void OnRemove(int index, object value)
  36. {
  37. base.OnRemove(index, value);
  38. if (Owner != null)
  39. (Owner as TableBase).CorrectSpansOnColumnChange(index, -1);
  40. }
  41. internal TableColumnCollection(Base owner) : base(owner)
  42. {
  43. }
  44. }
  45. }