private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { if (hWindow == null) { return; } switch (this.tabControl1.SelectedIndex) { case 1: this.tabCurrent.Controls.Clear(); this.tabCurrent.Controls.Add(hWindow); HImage hImage = Machine.Instance.Camera.Executor.CurrentBytes.ToHImage( Machine.Instance.Camera.Executor.ImageWidth, Machine.Instance.Camera.Executor.ImageHeight); this.currentImage = hImage; this.tempImage = this.currentImage; break; case 2: this.tabReference.Controls.Clear(); this.tabReference.Controls.Add(hWindow); this.tempImage = this.referenceImage; break; } this.slectedTabIndex = this.tabControl1.SelectedIndex; mView.resetWindow(); mView.HRegionList.Clear(); mView.setImage(this.tempImage); mView.repaint(); }