//鼠标单击,选择相应的加载窗体类型 void firstPb_Click(object sender, EventArgs e) { PictureBox pb = sender as PictureBox; ImageModel imgEntity = getImageModel(pb.Name, imageModelist); RightPinal.Controls.Clear(); switch (imgEntity.ParentName.Trim()) { case "Blank Box": BlankBox frmblankBox = new BlankBox(); frmblankBox.TopLevel = false; frmblankBox.Parent = RightPinal; frmblankBox.Dock = DockStyle.Fill; frmblankBox.InitialValue(imgEntity);//获取点击的图标,传递其唯一标识,并赋值 frmblankBox.Show(); break; case "Coil": Coil frmCoil = new Coil(); frmCoil.TopLevel = false; frmCoil.Parent = RightPinal; frmCoil.Dock = DockStyle.Fill; frmCoil.InitialValue(imgEntity); frmCoil.Show(); break; case "Control Box": ControlBox frmControlBox = new ControlBox(); frmControlBox.TopLevel = false; frmControlBox.Parent = RightPinal; frmControlBox.Dock = DockStyle.Fill; frmControlBox.InitialValue(imgEntity); frmControlBox.Show(); break; case "Fan Box": FanBox frmFanBox = new FanBox(); frmFanBox.TopLevel = false; frmFanBox.Parent = RightPinal; frmFanBox.Dock = DockStyle.Fill; frmFanBox.InitialValue(imgEntity); frmFanBox.Show(); break; case "Filter": Filter frmFilter = new Filter(); frmFilter.TopLevel = false; frmFilter.Parent = RightPinal; frmFilter.Dock = DockStyle.Fill; frmFilter.InitialValue(imgEntity); frmFilter.Show(); break; case "Heat": Heat frmHeat = new Heat(); frmHeat.TopLevel = false; frmHeat.Parent = RightPinal; frmHeat.Dock = DockStyle.Fill; frmHeat.InitialValue(imgEntity); frmHeat.Show(); break; case "HR Wheel": HRWheel frmHRWheel = new HRWheel(); frmHRWheel.TopLevel = false; frmHRWheel.Parent = RightPinal; frmHRWheel.Dock = DockStyle.Fill; frmHRWheel.InitialValue(imgEntity); frmHRWheel.Show(); break; case "Mixing Box": MixingBox frmMixingBox = new MixingBox(); frmMixingBox.TopLevel = false; frmMixingBox.Parent = RightPinal; frmMixingBox.Dock = DockStyle.Fill; frmMixingBox.InitialValue(imgEntity);//获取点击的图标,传递其唯一标识 frmMixingBox.Show(); break; } }
public void ShowSelectedImg(string imgSelected,ImageModel ImMo) { switch (imgSelected) { case "Blank Box": BlankBox frmblankBox = new BlankBox(); frmblankBox.TopLevel = false; frmblankBox.Parent = RightPinal; frmblankBox.Dock = DockStyle.Fill; frmblankBox.InitialValue(ImMo);//获取点击的图标,传递其唯一标识,并赋值 frmblankBox.Show(); break; case "Coil": Coil frmCoil = new Coil(); frmCoil.TopLevel = false; frmCoil.Parent = RightPinal; frmCoil.Dock = DockStyle.Fill; frmCoil.InitialValue(ImMo); frmCoil.Show(); break; case "Control Box": ControlBox frmControlBox = new ControlBox(); frmControlBox.TopLevel = false; frmControlBox.Parent = RightPinal; frmControlBox.Dock = DockStyle.Fill; frmControlBox.InitialValue(ImMo); frmControlBox.Show(); break; case "Fan Box": FanBox frmFanBox = new FanBox(); frmFanBox.TopLevel = false; frmFanBox.Parent = RightPinal; frmFanBox.Dock = DockStyle.Fill; frmFanBox.InitialValue(ImMo); frmFanBox.Show(); break; case "Filter": Filter frmFilter = new Filter(); frmFilter.TopLevel = false; frmFilter.Parent = RightPinal; frmFilter.Dock = DockStyle.Fill; frmFilter.InitialValue(ImMo); frmFilter.Show(); break; case "Heat": Heat frmHeat = new Heat(); frmHeat.TopLevel = false; frmHeat.Parent = RightPinal; frmHeat.Dock = DockStyle.Fill; frmHeat.InitialValue(ImMo); frmHeat.Show(); break; case "HR Wheel": HRWheel frmHRWheel = new HRWheel(); frmHRWheel.TopLevel = false; frmHRWheel.Parent = RightPinal; frmHRWheel.Dock = DockStyle.Fill; frmHRWheel.InitialValue(ImMo); frmHRWheel.Show(); break; case "Mixing Box": MixingBox frmMixingBox = new MixingBox(); frmMixingBox.TopLevel = false; frmMixingBox.Parent = RightPinal; frmMixingBox.Dock = DockStyle.Fill; frmMixingBox.InitialValue(ImMo);//获取点击的图标,传递其唯一标识 frmMixingBox.Show(); break; } }