private void ResetControls()
 {
     selectedTeeth = new string[0];
     this.Controls.Clear();
     if (drawMode == DrawingMode.Simple2D)
     {
         //this.Invalidate();
         toothChart2D          = new ToothChart2D();
         toothChart2D.Dock     = System.Windows.Forms.DockStyle.Fill;
         toothChart2D.Location = new System.Drawing.Point(0, 0);
         toothChart2D.Name     = "toothChart2D";
         //toothChart2D.Size = new System.Drawing.Size(719,564);//unnecessary?
         toothChart2D.SegmentDrawn           += new ToothChartDrawEventHandler(toothChart_SegmentDrawn);
         toothChart2D.ToothSelectionsChanged += new ToothChartSelectionEventHandler(toothChart_ToothSelectionsChanged);
         toothChart2D.TcData = tcData;
         toothChart2D.SuspendLayout();
         this.Controls.Add(toothChart2D);
         ResetTeeth();
         toothChart2D.InitializeGraphics();
         toothChart2D.ResumeLayout();
     }
     else if (drawMode == DrawingMode.DirectX)
     {
         //I noticed that this code executes when the program starts, then also when the Chart module is selected for the first time.
         //Thus the Chart graphic was loading twice before the user could see it.
         bool isInitialized = true;
         if (toothChartDirectX == null)
         {
             isInitialized = false;
         }
         if (isInitialized)
         {
             //Since the control is already initialized, reuse it.  This helps the load time of the Chart module and helps to prevent an issue.
             //This flag helps prevent a red X on the tooth chart when the Chart module is left open and the Windows user is switched then switched back.
         }
         else
         {
             toothChartDirectX = new ToothChartDirectX();                  //(hardwareMode,preferredPixelFormatNum);
         }
         //preferredPixelFormatNum=toothChart.SelectedPixelFormatNumber;
         //toothChartDirectX.ColorText=colorText;
         toothChartDirectX.Dock     = System.Windows.Forms.DockStyle.Fill;
         toothChartDirectX.Location = new System.Drawing.Point(0, 0);
         toothChartDirectX.Name     = "toothChartDirectX";
         //toothChartDirectX.Size = new System.Drawing.Size(719,564);//unnecessary?
         toothChartDirectX.SegmentDrawn           += new ToothChartDrawEventHandler(toothChart_SegmentDrawn);
         toothChartDirectX.ToothSelectionsChanged += new ToothChartSelectionEventHandler(toothChart_ToothSelectionsChanged);
         toothChartDirectX.TcData = tcData;
         toothChartDirectX.SuspendLayout();                //Might help with the MDA debug error we used to get (if the option wasn't disabled in our compilers).
         this.Controls.Add(toothChartDirectX);
         ResetTeeth();
         toothChartDirectX.deviceFormat = deviceFormat;
         if (!isInitialized)
         {
             toothChartDirectX.InitializeGraphics();
         }
         toothChartDirectX.ResumeLayout();                //Might help with the MDA debug error we used to get (if the option wasn't disabled in our compilers).
     }
     else if (drawMode == DrawingMode.OpenGL)
     {
         toothChartOpenGL        = new ToothChartOpenGL(hardwareMode, preferredPixelFormatNum);
         preferredPixelFormatNum = toothChartOpenGL.SelectedPixelFormatNumber;
         //toothChartOpenGL.ColorText=colorText;
         toothChartOpenGL.Dock     = System.Windows.Forms.DockStyle.Fill;
         toothChartOpenGL.Location = new System.Drawing.Point(0, 0);
         toothChartOpenGL.Name     = "toothChartOpenGL";
         //toothChartOpenGL.Size = new System.Drawing.Size(719,564);//unnecessary?
         toothChartOpenGL.TcData                  = tcData;
         toothChartOpenGL.SegmentDrawn           += new ToothChartDrawEventHandler(toothChart_SegmentDrawn);
         toothChartOpenGL.ToothSelectionsChanged += new ToothChartSelectionEventHandler(toothChart_ToothSelectionsChanged);
         toothChartOpenGL.SuspendLayout();
         this.Controls.Add(toothChartOpenGL);
         ResetTeeth();
         toothChartOpenGL.InitializeGraphics();                //MakeDisplayLists();
         toothChartOpenGL.ResumeLayout();
     }
 }
		private void ResetControls(){
			selectedTeeth=new string[0];
			this.Controls.Clear();
			if(drawMode==DrawingMode.Simple2D){
				//this.Invalidate();
				toothChart2D=new ToothChart2D();
				toothChart2D.Dock = System.Windows.Forms.DockStyle.Fill;
				toothChart2D.Location = new System.Drawing.Point(0,0);
				toothChart2D.Name = "toothChart2D";
				//toothChart2D.Size = new System.Drawing.Size(719,564);//unnecessary?
				toothChart2D.SegmentDrawn+=new ToothChartDrawEventHandler(toothChart_SegmentDrawn);
				toothChart2D.TcData=tcData;
				toothChart2D.SuspendLayout();
				this.Controls.Add(toothChart2D);
				ResetTeeth();
				toothChart2D.InitializeGraphics();
				toothChart2D.ResumeLayout();
			}
			else if(drawMode==DrawingMode.DirectX){
				if(toothChartDirectX!=null){
					toothChartDirectX.Dispose();
					toothChartDirectX=null;
				}
				toothChartDirectX=new ToothChartDirectX();//(hardwareMode,preferredPixelFormatNum);
				//preferredPixelFormatNum=toothChart.SelectedPixelFormatNumber;
				//toothChartDirectX.ColorText=colorText;
				toothChartDirectX.Dock = System.Windows.Forms.DockStyle.Fill;
				toothChartDirectX.Location = new System.Drawing.Point(0,0);
				toothChartDirectX.Name = "toothChartDirectX";
				//toothChartDirectX.Size = new System.Drawing.Size(719,564);//unnecessary?
				toothChartDirectX.SegmentDrawn+=new ToothChartDrawEventHandler(toothChart_SegmentDrawn);
				toothChartDirectX.TcData=tcData;
				toothChartDirectX.SuspendLayout();//Might help with the MDA debug error we used to get (if the option wasn't disabled in our compilers).
				this.Controls.Add(toothChartDirectX);
				ResetTeeth();
				toothChartDirectX.deviceFormat=deviceFormat;
				toothChartDirectX.InitializeGraphics();
				toothChartDirectX.ResumeLayout();//Might help with the MDA debug error we used to get (if the option wasn't disabled in our compilers).
			}
			else if(drawMode==DrawingMode.OpenGL){
				toothChartOpenGL=new ToothChartOpenGL(hardwareMode,preferredPixelFormatNum);
				preferredPixelFormatNum=toothChartOpenGL.SelectedPixelFormatNumber;
				//toothChartOpenGL.ColorText=colorText;
				toothChartOpenGL.Dock = System.Windows.Forms.DockStyle.Fill;
				toothChartOpenGL.Location = new System.Drawing.Point(0,0);
				toothChartOpenGL.Name = "toothChartOpenGL";
				//toothChartOpenGL.Size = new System.Drawing.Size(719,564);//unnecessary?
				toothChartOpenGL.TcData=tcData;
				toothChartOpenGL.SegmentDrawn+=new ToothChartDrawEventHandler(toothChart_SegmentDrawn);
				toothChartOpenGL.SuspendLayout();
				this.Controls.Add(toothChartOpenGL);
				ResetTeeth();
				toothChartOpenGL.InitializeGraphics();//MakeDisplayLists();
				toothChartOpenGL.ResumeLayout();
			}
		}
Exemple #3
0
 private void ResetControls()
 {
     selectedTeeth = new string[0];
     this.Controls.Clear();
     if (drawMode == DrawingMode.Simple2D)
     {
         //this.Invalidate();
         toothChart2D          = new ToothChart2D();
         toothChart2D.Dock     = System.Windows.Forms.DockStyle.Fill;
         toothChart2D.Location = new System.Drawing.Point(0, 0);
         toothChart2D.Name     = "toothChart2D";
         //toothChart2D.Size = new System.Drawing.Size(719,564);//unnecessary?
         toothChart2D.SegmentDrawn += new ToothChartDrawEventHandler(toothChart_SegmentDrawn);
         toothChart2D.TcData        = tcData;
         toothChart2D.SuspendLayout();
         this.Controls.Add(toothChart2D);
         ResetTeeth();
         toothChart2D.InitializeGraphics();
         toothChart2D.ResumeLayout();
     }
     else if (drawMode == DrawingMode.DirectX)
     {
         if (toothChartDirectX != null)
         {
             toothChartDirectX.Dispose();
             toothChartDirectX = null;
         }
         toothChartDirectX = new ToothChartDirectX();              //(hardwareMode,preferredPixelFormatNum);
         //preferredPixelFormatNum=toothChart.SelectedPixelFormatNumber;
         //toothChartDirectX.ColorText=colorText;
         toothChartDirectX.Dock     = System.Windows.Forms.DockStyle.Fill;
         toothChartDirectX.Location = new System.Drawing.Point(0, 0);
         toothChartDirectX.Name     = "toothChartDirectX";
         //toothChartDirectX.Size = new System.Drawing.Size(719,564);//unnecessary?
         toothChartDirectX.SegmentDrawn += new ToothChartDrawEventHandler(toothChart_SegmentDrawn);
         toothChartDirectX.TcData        = tcData;
         toothChartDirectX.SuspendLayout();                //Might help with the MDA debug error we used to get (if the option wasn't disabled in our compilers).
         this.Controls.Add(toothChartDirectX);
         ResetTeeth();
         toothChartDirectX.deviceFormat = deviceFormat;
         toothChartDirectX.InitializeGraphics();
         toothChartDirectX.ResumeLayout();                //Might help with the MDA debug error we used to get (if the option wasn't disabled in our compilers).
     }
     else if (drawMode == DrawingMode.OpenGL)
     {
         toothChartOpenGL        = new ToothChartOpenGL(hardwareMode, preferredPixelFormatNum);
         preferredPixelFormatNum = toothChartOpenGL.SelectedPixelFormatNumber;
         //toothChartOpenGL.ColorText=colorText;
         toothChartOpenGL.Dock     = System.Windows.Forms.DockStyle.Fill;
         toothChartOpenGL.Location = new System.Drawing.Point(0, 0);
         toothChartOpenGL.Name     = "toothChartOpenGL";
         //toothChartOpenGL.Size = new System.Drawing.Size(719,564);//unnecessary?
         toothChartOpenGL.TcData        = tcData;
         toothChartOpenGL.SegmentDrawn += new ToothChartDrawEventHandler(toothChart_SegmentDrawn);
         toothChartOpenGL.SuspendLayout();
         this.Controls.Add(toothChartOpenGL);
         ResetTeeth();
         toothChartOpenGL.InitializeGraphics();                //MakeDisplayLists();
         toothChartOpenGL.ResumeLayout();
     }
 }