Beispiel #1
0
		private void PrepImageForPrinting(){
			//linesPrinted=0;
			ColTotal = new double[10];
			//headingPrinted=false;
			//graphicsPrinted=false;
			//mainPrinted=false;
			//benefitsPrinted=false;
			//notePrinted=false;
			//pagesPrinted=0;
			if(PrefC.GetBool(PrefName.TreatPlanShowGraphics)){
				//prints the graphical tooth chart and legend
				//Panel panelHide=new Panel();
				//panelHide.Size=new Size(600,500);
				//panelHide.BackColor=this.BackColor;
				//panelHide.SendToBack();
				//this.Controls.Add(panelHide);
				toothChart=new ToothChartWrapper();
				toothChart.ColorBackground=DefC.Long[(int)DefCat.ChartGraphicColors][14].ItemColor;
				toothChart.ColorText=DefC.Long[(int)DefCat.ChartGraphicColors][15].ItemColor;
				//toothChart.TaoRenderEnabled=true;
				//toothChart.TaoInitializeContexts();
				toothChart.Size=new Size(500,370);
				//toothChart.Location=new Point(-600,-500);//off the visible screen
				//toothChart.SendToBack();
				//ComputerPref computerPref=ComputerPrefs.GetForLocalComputer();
				toothChart.UseHardware=ComputerPrefs.LocalComputer.GraphicsUseHardware;
				toothChart.SetToothNumberingNomenclature((ToothNumberingNomenclature)PrefC.GetInt(PrefName.UseInternationalToothNumbers));
				toothChart.PreferredPixelFormatNumber=ComputerPrefs.LocalComputer.PreferredPixelFormatNum;
				toothChart.DeviceFormat=new ToothChartDirectX.DirectXDeviceFormat(ComputerPrefs.LocalComputer.DirectXFormat);
				//Must be last setting set for preferences, because
																														//this is the line where the device pixel format is
																														//recreated.
																														//The preferred pixel format number changes to the selected pixel format number after a context is chosen.
				toothChart.DrawMode=ComputerPrefs.LocalComputer.GraphicsSimple;
				ComputerPrefs.LocalComputer.PreferredPixelFormatNum=toothChart.PreferredPixelFormatNumber;
				ComputerPrefs.Update(ComputerPrefs.LocalComputer);
				this.Controls.Add(toothChart);
				toothChart.BringToFront();
				toothChart.ResetTeeth();
				ToothInitialList=ToothInitials.Refresh(PatCur.PatNum);
				//first, primary.  That way, you can still set a primary tooth missing afterwards.
				for(int i=0;i<ToothInitialList.Count;i++) {
					if(ToothInitialList[i].InitialType==ToothInitialType.Primary) {
						toothChart.SetPrimary(ToothInitialList[i].ToothNum);
					}
				}
				for(int i=0;i<ToothInitialList.Count;i++) {
					switch(ToothInitialList[i].InitialType) {
						case ToothInitialType.Missing:
							toothChart.SetMissing(ToothInitialList[i].ToothNum);
							break;
						case ToothInitialType.Hidden:
							toothChart.SetHidden(ToothInitialList[i].ToothNum);
							break;
						case ToothInitialType.Rotate:
							toothChart.MoveTooth(ToothInitialList[i].ToothNum,ToothInitialList[i].Movement,0,0,0,0,0);
							break;
						case ToothInitialType.TipM:
							toothChart.MoveTooth(ToothInitialList[i].ToothNum,0,ToothInitialList[i].Movement,0,0,0,0);
							break;
						case ToothInitialType.TipB:
							toothChart.MoveTooth(ToothInitialList[i].ToothNum,0,0,ToothInitialList[i].Movement,0,0,0);
							break;
						case ToothInitialType.ShiftM:
							toothChart.MoveTooth(ToothInitialList[i].ToothNum,0,0,0,ToothInitialList[i].Movement,0,0);
							break;
						case ToothInitialType.ShiftO:
							toothChart.MoveTooth(ToothInitialList[i].ToothNum,0,0,0,0,ToothInitialList[i].Movement,0);
							break;
						case ToothInitialType.ShiftB:
							toothChart.MoveTooth(ToothInitialList[i].ToothNum,0,0,0,0,0,ToothInitialList[i].Movement);
							break;
						case ToothInitialType.Drawing:
							toothChart.AddDrawingSegment(ToothInitialList[i].Copy());
							break;
					}
				}
				ComputeProcListFiltered();
				DrawProcsGraphics();
				toothChart.AutoFinish=true;
				chartBitmap=toothChart.GetBitmap();
				toothChart.Dispose();
			}
		}
		///<summary>Returns true if the given directXFormat works for a DirectX tooth chart on the local computer.</summary>
		public static bool TestDirectXFormat(Form callingForm,string directXFormat) {
			ToothChartWrapper toothChartTest=new ToothChartWrapper();
			toothChartTest.Visible=false;
			//We add the invisible tooth chart to our form so that the device context will initialize properly
			//and our device creation test will then be accurate.
			callingForm.Controls.Add(toothChartTest);
			toothChartTest.DeviceFormat=new ToothChartDirectX.DirectXDeviceFormat(directXFormat);
			toothChartTest.DrawMode=DrawingMode.DirectX;//Creates the device.
			if(toothChartTest.DrawMode==DrawingMode.Simple2D) {
				//The chart is set back to 2D mode when there is an error initializing.
				callingForm.Controls.Remove(toothChartTest);
				toothChartTest.Dispose();
				return false;
			}
			//Now we check to be sure that one can draw and retrieve a screen shot from a DirectX control
			//using the specified device format.
			try {
				Bitmap screenShot=toothChartTest.GetBitmap();
				screenShot.Dispose();
			} 
			catch {
				callingForm.Controls.Remove(toothChartTest);
				toothChartTest.Dispose();
				return false;
			}
			callingForm.Controls.Remove(toothChartTest);
			toothChartTest.Dispose();
			return true;
		}