DockWindowCollection.cs
上传用户:szlfmled
上传日期:2020-11-22
资源大小:978k
文件大小:1k
源码类别:

C#编程

开发平台:

C#

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. namespace WeifenLuo.WinFormsUI.Docking
  5. {
  6. public class DockWindowCollection : ReadOnlyCollection<DockWindow>
  7. {
  8. internal DockWindowCollection(DockPanel dockPanel)
  9.             : base(new List<DockWindow>())
  10. {
  11. Items.Add(new DockWindow(dockPanel, DockState.Document));
  12. Items.Add(new DockWindow(dockPanel, DockState.DockLeft));
  13. Items.Add(new DockWindow(dockPanel, DockState.DockRight));
  14. Items.Add(new DockWindow(dockPanel, DockState.DockTop));
  15. Items.Add(new DockWindow(dockPanel, DockState.DockBottom));
  16. }
  17. public DockWindow this [DockState dockState]
  18. {
  19. get
  20. {
  21. if (dockState == DockState.Document)
  22. return Items[0];
  23. else if (dockState == DockState.DockLeft || dockState == DockState.DockLeftAutoHide)
  24. return Items[1];
  25. else if (dockState == DockState.DockRight || dockState == DockState.DockRightAutoHide)
  26. return Items[2];
  27. else if (dockState == DockState.DockTop || dockState == DockState.DockTopAutoHide)
  28. return Items[3];
  29. else if (dockState == DockState.DockBottom || dockState == DockState.DockBottomAutoHide)
  30. return Items[4];
  31. throw (new ArgumentOutOfRangeException());
  32. }
  33. }
  34. }
  35. }