RefreshForm.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace IntelligentControlForsx.Test
  11. {
  12. public partial class RefreshForm : Form
  13. {
  14. Dictionary<string, Form> dic = new Dictionary<string, Form>();
  15. public RefreshForm()
  16. {
  17. InitializeComponent();
  18. }
  19. private void btnShow1_Click(object sender, EventArgs e)
  20. {
  21. if (CacheForm.dicMain1Form.ContainsKey("f1"))
  22. {
  23. Form f1 = CacheForm.dicMain1Form["f1"];
  24. f1.TopLevel = true;
  25. //f1.Width = 1884;
  26. //f1.Height = 961;
  27. //f1.Visible = true;
  28. // f1.Show();
  29. }
  30. if (CacheForm.dicMain1Form.ContainsKey("f2"))
  31. {
  32. Form f2 = CacheForm.dicMain1Form["f2"];
  33. f2.TopLevel = false;
  34. //f2.Width = 0;
  35. //f2.Height = 0;
  36. // f2.Visible = false;
  37. // f2.Show();
  38. }
  39. }
  40. private void btnShow2_Click(object sender, EventArgs e)
  41. {
  42. if (CacheForm.dicMain1Form.ContainsKey("f1"))
  43. {
  44. Form f1 = CacheForm.dicMain1Form["f1"];
  45. f1.TopLevel = false;
  46. // f1.Visible = false;
  47. //f1.Width = 0;
  48. //f1.Height = 0;
  49. // f1.Show();
  50. }
  51. if (CacheForm.dicMain1Form.ContainsKey("f2"))
  52. {
  53. Form f2 = CacheForm.dicMain1Form["f2"];
  54. f2.TopLevel = true;
  55. //f2.Width = 1884;
  56. //f2.Height = 961;
  57. // f2.Show();
  58. }
  59. }
  60. private void btnInit_Click(object sender, EventArgs e)
  61. {
  62. Form1 f1 = new Form1();
  63. f1.MdiParent = this;
  64. f1.Parent = this.panel1;
  65. //f1.Dock = DockStyle.Fill;
  66. Form2 f2 = new Form2();
  67. f2.MdiParent = this;
  68. f2.Parent = this.panel1;
  69. f2.TopLevel = false;
  70. // f2.Dock = DockStyle.Fill;
  71. f1.Show();
  72. f2.Show();
  73. CacheForm.dicMain1Form.Add("mainForm1",this);
  74. CacheForm.dicMain1Form.Add("f1", f1);
  75. CacheForm.dicMain1Form.Add("f2", f2);
  76. RefreshForm2 mainForm2 = new RefreshForm2();
  77. HomeTest home = new HomeTest();
  78. home.MdiParent = mainForm2;
  79. home.Parent = mainForm2.panel1;
  80. home.Dock = DockStyle.Fill;
  81. InfoTest info = new InfoTest();
  82. info.MdiParent = mainForm2;
  83. info.Parent = mainForm2.panel1;
  84. info.Dock = DockStyle.Fill;
  85. ControlTest control = new ControlTest();
  86. control.MdiParent = mainForm2;
  87. control.Parent = mainForm2.panel1;
  88. control.Dock = DockStyle.Fill;
  89. CacheForm.dicMain2Form.Add("mainForm2", mainForm2);
  90. CacheForm.dicMain2Form.Add("home", home);
  91. CacheForm.dicMain2Form.Add("info", info);
  92. CacheForm.dicMain2Form.Add("control", control);
  93. }
  94. private void btnHome_Click(object sender, EventArgs e)
  95. {
  96. if (CacheForm.dicMain2Form.ContainsKey("mainForm2"))
  97. {
  98. RefreshForm2 f = (RefreshForm2)CacheForm.dicMain2Form["mainForm2"];
  99. f.TopLevel = true;
  100. f.PageChange("home");
  101. f.ShowDialog();
  102. }
  103. if (CacheForm.dicMain1Form.ContainsKey("mainForm1"))
  104. {
  105. Form f = CacheForm.dicMain1Form["mainForm1"];
  106. //.TopLevel = false;
  107. }
  108. }
  109. private void btnWindturbineInfo_Click(object sender, EventArgs e)
  110. {
  111. if (CacheForm.dicMain2Form.ContainsKey("mainForm2"))
  112. {
  113. RefreshForm2 f = (RefreshForm2)CacheForm.dicMain2Form["mainForm2"];
  114. f.TopLevel =true;
  115. f.ShowDialog();
  116. f.PageChange("info");
  117. }
  118. if (CacheForm.dicMain1Form.ContainsKey("mainForm1"))
  119. {
  120. Form f = CacheForm.dicMain1Form["mainForm1"];
  121. // f.TopLevel = false;
  122. }
  123. }
  124. private void btnControl_Click(object sender, EventArgs e)
  125. {
  126. if (CacheForm.dicMain2Form.ContainsKey("mainForm2"))
  127. {
  128. RefreshForm2 f = (RefreshForm2)CacheForm.dicMain2Form["mainForm2"];
  129. f.TopLevel = true;
  130. f.ShowDialog();
  131. f.PageChange("control");
  132. }
  133. if (CacheForm.dicMain1Form.ContainsKey("mainForm1"))
  134. {
  135. Form f = CacheForm.dicMain1Form["mainForm1"];
  136. // f.TopLevel = false;
  137. }
  138. }
  139. }
  140. }