Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

DrawingContext, Text, CultureInvariant, Printing, Windows10

$
0
0

I have encountered a problem when testing printing from application on Windows 10 (Pro Insider preview EN_US 10130). I found out that my code that prints document is failing and problem lies in drawingContext.DrawText() call. I found that "CultureInfo.InvariantCulture" has to be changed to something different, for example new CultureInfo("en-US") otherwise my printout fails.

Is there a reason why it is failing, or is it a bug in Windows 10? This solution worked fine so far on systems with Windows XP, 7, 8 and 8.1. Here is code that I use:

var visual =newDrawingVisual();using(DrawingContext context = visual.RenderOpen()){
    context.DrawText(newFormattedText("my text",CultureInfo.InvariantCulture,// new CultureInfo("en-US")FlowDirection.LeftToRight,newTypeface(newFontFamily("Arial"),FontStyles.Normal,FontWeights.Normal,FontStretches.Normal),15,newSolidColorBrush(Color.FromRgb(0,39,91))),newPoint(10,20));}
This question is a duplicate of http://stackoverflow.com/questions/31111904/drawingcontext-text-cultureinvariant-printing-windows10

Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>