123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace IntelligentControlForsx.Test
- {
- public partial class RefreshForm : Form
- {
- Dictionary<string, Form> dic = new Dictionary<string, Form>();
- public RefreshForm()
- {
- InitializeComponent();
- }
- private void btnShow1_Click(object sender, EventArgs e)
- {
- if (CacheForm.dicMain1Form.ContainsKey("f1"))
- {
- Form f1 = CacheForm.dicMain1Form["f1"];
- f1.TopLevel = true;
- //f1.Width = 1884;
- //f1.Height = 961;
- //f1.Visible = true;
- // f1.Show();
-
- }
- if (CacheForm.dicMain1Form.ContainsKey("f2"))
- {
- Form f2 = CacheForm.dicMain1Form["f2"];
- f2.TopLevel = false;
- //f2.Width = 0;
- //f2.Height = 0;
- // f2.Visible = false;
- // f2.Show();
- }
- }
- private void btnShow2_Click(object sender, EventArgs e)
- {
- if (CacheForm.dicMain1Form.ContainsKey("f1"))
- {
- Form f1 = CacheForm.dicMain1Form["f1"];
- f1.TopLevel = false;
- // f1.Visible = false;
- //f1.Width = 0;
- //f1.Height = 0;
- // f1.Show();
- }
- if (CacheForm.dicMain1Form.ContainsKey("f2"))
- {
- Form f2 = CacheForm.dicMain1Form["f2"];
- f2.TopLevel = true;
- //f2.Width = 1884;
- //f2.Height = 961;
- // f2.Show();
- }
- }
- private void btnInit_Click(object sender, EventArgs e)
- {
- Form1 f1 = new Form1();
- f1.MdiParent = this;
- f1.Parent = this.panel1;
-
- //f1.Dock = DockStyle.Fill;
- Form2 f2 = new Form2();
- f2.MdiParent = this;
- f2.Parent = this.panel1;
- f2.TopLevel = false;
- // f2.Dock = DockStyle.Fill;
- f1.Show();
- f2.Show();
- CacheForm.dicMain1Form.Add("mainForm1",this);
- CacheForm.dicMain1Form.Add("f1", f1);
- CacheForm.dicMain1Form.Add("f2", f2);
- RefreshForm2 mainForm2 = new RefreshForm2();
- HomeTest home = new HomeTest();
- home.MdiParent = mainForm2;
- home.Parent = mainForm2.panel1;
- home.Dock = DockStyle.Fill;
- InfoTest info = new InfoTest();
- info.MdiParent = mainForm2;
- info.Parent = mainForm2.panel1;
- info.Dock = DockStyle.Fill;
- ControlTest control = new ControlTest();
- control.MdiParent = mainForm2;
- control.Parent = mainForm2.panel1;
- control.Dock = DockStyle.Fill;
- CacheForm.dicMain2Form.Add("mainForm2", mainForm2);
- CacheForm.dicMain2Form.Add("home", home);
- CacheForm.dicMain2Form.Add("info", info);
- CacheForm.dicMain2Form.Add("control", control);
- }
- private void btnHome_Click(object sender, EventArgs e)
- {
- if (CacheForm.dicMain2Form.ContainsKey("mainForm2"))
- {
- RefreshForm2 f = (RefreshForm2)CacheForm.dicMain2Form["mainForm2"];
- f.TopLevel = true;
- f.PageChange("home");
- f.ShowDialog();
-
- }
- if (CacheForm.dicMain1Form.ContainsKey("mainForm1"))
- {
- Form f = CacheForm.dicMain1Form["mainForm1"];
- //.TopLevel = false;
- }
- }
- private void btnWindturbineInfo_Click(object sender, EventArgs e)
- {
- if (CacheForm.dicMain2Form.ContainsKey("mainForm2"))
- {
- RefreshForm2 f = (RefreshForm2)CacheForm.dicMain2Form["mainForm2"];
- f.TopLevel =true;
- f.ShowDialog();
- f.PageChange("info");
- }
- if (CacheForm.dicMain1Form.ContainsKey("mainForm1"))
- {
- Form f = CacheForm.dicMain1Form["mainForm1"];
- // f.TopLevel = false;
- }
- }
- private void btnControl_Click(object sender, EventArgs e)
- {
- if (CacheForm.dicMain2Form.ContainsKey("mainForm2"))
- {
- RefreshForm2 f = (RefreshForm2)CacheForm.dicMain2Form["mainForm2"];
- f.TopLevel = true;
- f.ShowDialog();
- f.PageChange("control");
- }
- if (CacheForm.dicMain1Form.ContainsKey("mainForm1"))
- {
- Form f = CacheForm.dicMain1Form["mainForm1"];
- // f.TopLevel = false;
- }
- }
-
- }
- }
|