1

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 = new DrawingVisual();
using (DrawingContext context = visual.RenderOpen())
{
    context.DrawText(
        new FormattedText(
            "my text",
            CultureInfo.InvariantCulture, // new CultureInfo("en-US")
            FlowDirection.LeftToRight,
            new Typeface(new FontFamily("Arial"), FontStyles.Normal, FontWeights.Normal, FontStretches.Normal),
            15,
            new SolidColorBrush(Color.FromRgb(0, 39, 91))),
        new Point(10, 20));
}
leppie
  • 115,091
  • 17
  • 196
  • 297
MiroJanosik
  • 675
  • 5
  • 30
  • I have run in to this issue on Windows 7 as well so I don't believe its Windows 10 specific. To be on the safe side I used CultureInfo.CurrentUICulture. – Void Dec 04 '15 at 15:28
  • Then I think that you had a different issue there, because I suppose that CurrentUICulture is usually set to some language, for example to "en-US". Do you know what was your value of CurrentUICulture? – MiroJanosik Dec 06 '15 at 13:08

0 Answers0