DocumentWindow.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Windows.Forms;
  5. using System.Drawing;
  6. #if !MONO
  7. using FastReport.DevComponents.DotNetBar;
  8. #else
  9. using FastReport.Controls;
  10. #endif
  11. namespace FastReport.Design
  12. {
  13. #if !MONO
  14. internal class DocumentWindow : TabItem
  15. {
  16. public Control ParentControl
  17. {
  18. get { return AttachedControl; }
  19. }
  20. public void AddToTabControl(FastReport.DevComponents.DotNetBar.TabControl tabs)
  21. {
  22. TabControlPanel panel = AttachedControl as TabControlPanel;
  23. tabs.Tabs.Add(this);
  24. tabs.Controls.Add(panel);
  25. tabs.ApplyDefaultPanelStyle(panel);
  26. panel.Padding = new System.Windows.Forms.Padding(0);
  27. if (tabs.Style == eTabStripStyle.VS2005Document)
  28. {
  29. panel.Style.BorderSide = eBorderSide.Bottom;
  30. panel.Padding = new System.Windows.Forms.Padding(0, 0, 0, 1);
  31. panel.Style.BorderColor.Color = SystemColors.ControlDark;
  32. }
  33. }
  34. public void Activate()
  35. {
  36. Parent.SelectedTab = this;
  37. }
  38. public void Close()
  39. {
  40. Parent.Tabs.Remove(this);
  41. Dispose();
  42. }
  43. public virtual void Localize()
  44. {
  45. }
  46. public virtual void UpdateDpiDependencies()
  47. {
  48. }
  49. public virtual void UpdateUIStyle()
  50. {
  51. }
  52. public DocumentWindow()
  53. {
  54. TabControlPanel panel = new TabControlPanel();
  55. // size is required in order to restore splitter distance correctly
  56. panel.Size = new Size(1000, 500);
  57. panel.Dock = DockStyle.Fill;
  58. panel.TabItem = this;
  59. AttachedControl = panel;
  60. }
  61. }
  62. #else
  63. internal class DocumentWindow : PageControlPage
  64. {
  65. private FRTabControl parent;
  66. public Control ParentControl
  67. {
  68. get { return parent; }
  69. }
  70. public void AddToTabControl(FRTabControl tabs)
  71. {
  72. tabs.Tabs.Add(this);
  73. parent = tabs;
  74. }
  75. public void Activate()
  76. {
  77. parent.SelectedTab = this;
  78. }
  79. public void Close()
  80. {
  81. parent.Tabs.Remove(this);
  82. Dispose();
  83. }
  84. public virtual void Localize()
  85. {
  86. }
  87. public virtual void UpdateDpiDependencies()
  88. {
  89. }
  90. public virtual void UpdateUIStyle()
  91. {
  92. }
  93. public DocumentWindow()
  94. {
  95. Dock = DockStyle.Fill;
  96. }
  97. }
  98. #endif
  99. }