@@ -120,26 +120,22 @@ Canvas RenderGraphicsContainer(IExportColumn column)
120120 public override void Visit ( ExportText exportColumn ) {
121121
122122 var formattedText = FixedDocumentCreator . CreateFormattedText ( ( ExportText ) exportColumn ) ;
123- var visual = new DrawingVisual ( ) ;
124-
125123 var location = new Point ( exportColumn . Location . X , exportColumn . Location . Y ) ;
126124
127- using ( var dc = visual . RenderOpen ( ) ) {
125+ var visual = new DrawingVisual ( ) ;
126+ using ( var drawingContext = visual . RenderOpen ( ) ) {
128127 if ( ShouldSetBackcolor ( exportColumn ) ) {
129- dc . DrawRectangle ( FixedDocumentCreator . ConvertBrush ( exportColumn . BackColor ) ,
128+ drawingContext . DrawRectangle ( FixedDocumentCreator . ConvertBrush ( exportColumn . BackColor ) ,
130129 null ,
131130 new Rect ( location , new Size ( exportColumn . Size . Width , exportColumn . Size . Height ) ) ) ;
132131 }
133-
132+ //http://stackoverflow.com/questions/4542717/length-of-string-that-will-fit-in-a-specific-width
134133// http://stackoverflow.com/questions/9264398/how-to-calculate-wpf-textblock-width-for-its-known-font-size-and-characters
135134
136- // if (exportColumn.ContentAlignment == System.Drawing.ContentAlignment.MiddleCenter) {
137- // location = new Point(location.X + (exportColumn.Size.Width - formattedText.Width) /2,location.Y + (exportColumn.Size.Height - formattedText.Height) / 2);
138- // }
139135 var offset = FixedDocumentCreator . CalculateAlignmentOffset ( formattedText , exportColumn ) ;
140136 var newLoc = new Point ( location . X + offset . X , location . Y + offset . Y ) ;
141- // dc.DrawText(formattedText,location);
142- dc . DrawText ( formattedText , newLoc ) ;
137+
138+ drawingContext . DrawText ( formattedText , newLoc ) ;
143139 }
144140 var dragingElement = new DrawingElement ( visual ) ;
145141 UIElement = dragingElement ;
0 commit comments