public Grid GetMainGrid(netDxf.DxfDocument dxfFile, bool avecGrille, bool avecOrigine, Color bgColor) { mainCanvas.Children.Clear(); DrawEntities.RazMaxDim(); DrawEntities.AddNewMaxDim(); mainGrid.HorizontalAlignment = HorizontalAlignment.Stretch; mainGrid.VerticalAlignment = VerticalAlignment.Stretch; mainGrid.Background = new SolidColorBrush(bgColor); border.Height = GridHeight; border.Width = GridWidth; border.Background = new SolidColorBrush(bgColor); mainCanvas.Name = "mainCanvas"; if (DxfDoc.DrawingVariables.AcadVer < netDxf.Header.DxfVersion.AutoCad2000) { DrawUtils.DrawText("Le format du fichier doit être dxf2000 ou supérieur.", 10, Colors.Red, 20, 50, mainCanvas); } GetCanvas(DxfDoc, mainCanvas); if (avecOrigine == true) { DrawEntities.AddNewMaxDim(); DrawUtils.DrawOrigin(mainCanvas); DrawEntities.DeleteLastMaxDim(); } if (avecGrille == true) { Canvas bgCanvas = new Canvas(); if (border.Child == null) { bgCanvas = CreateBgCanvas(); bgCanvas.Children.Add(mainCanvas); border.Child = bgCanvas; } } else { border.Child = mainCanvas; } Canvas.SetTop(mainCanvas, GridHeight / 2); Canvas.SetLeft(mainCanvas, GridWidth / 2); //border.Reset(GridHeight,GridWidth,true,ViewHeight,ViewWidth,WinHeight,WinWidth); if (mainGrid.Children.Count == 0) { mainGrid.Children.Add(border); } return(mainGrid); }
/*Draw Underlay*/ public static void DrawUnderlay(Underlay xUnderlay, Canvas mainCanvas) { /*DrawUtils.DrawPoint(xUnderlay.Position, mainCanvas, Colors.Red, 10, 0.5);*/ DrawUtils.DrawText(xUnderlay.Definition.FileName, 10, TypeConverter.ToMediaColor(xUnderlay.getColor().ToColor()), xUnderlay.Position.X, xUnderlay.Position.Y + 20, mainCanvas); }