SelectedPictureObjects.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Drawing;
  5. using System.Windows.Forms;
  6. using FastReport.Design;
  7. namespace FastReport
  8. {
  9. internal class SelectedPictureObjects
  10. {
  11. private List<PictureObject> list;
  12. private Designer designer;
  13. public PictureObject First
  14. {
  15. get { return list.Count > 0 ? list[0] : null; }
  16. }
  17. public int Count
  18. {
  19. get { return list.Count; }
  20. }
  21. public bool Enabled
  22. {
  23. get
  24. {
  25. return Count > 1 || (Count == 1 && CanModify(First));
  26. }
  27. }
  28. private List<PictureObject> ModifyList
  29. {
  30. get { return list.FindAll(CanModify); }
  31. }
  32. private bool CanModify(PictureObject c)
  33. {
  34. return !c.HasRestriction(Restrictions.DontModify);
  35. }
  36. public void Update()
  37. {
  38. list.Clear();
  39. if (designer.SelectedObjects != null)
  40. {
  41. foreach (Base c in designer.SelectedObjects)
  42. {
  43. if (c is PictureObject)
  44. list.Add(c as PictureObject);
  45. }
  46. }
  47. }
  48. public void SetSizeMode(PictureBoxSizeMode value)
  49. {
  50. foreach (PictureObject c in ModifyList)
  51. {
  52. c.SizeMode = value;
  53. }
  54. }
  55. public SelectedPictureObjects(Designer designer)
  56. {
  57. this.designer = designer;
  58. list = new List<PictureObject>();
  59. }
  60. }
  61. }