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));
}
Aucun commentaire:
Enregistrer un commentaire