Avec WPF4 vous pouvez avoir un texte non flou en ajoutant TextOptions.TextFormattingMode = "Affichage" et TextOptions.TextRenderingMode = "Aliased" à votre XAML:En utilisant TextOptions.TextFormattingMode avec FormattedText
<Window
TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="Aliased">
Cela fonctionne très bien pour moi, sauf quand je dessine du texte avec DrawingContext.DrawText comme ceci:
void DrawText(DrawingContext dc)
{
FormattedText ft = new FormattedText("Hello World",
System.Globalization.CultureInfo.CurrentCulture,
System.Windows.FlowDirection.LeftToRight,
new Typeface(FontFamily, FontStyle, FontWeight, FontStretch),
FontSize,
brush);
dc.DrawText(ft, new Point(rect.Left, rect.Top));
}
Comment puis-je dessiner le texte non-flou avec FormattedText? c'est-à-dire que je veux TextOptions.TextFormattingMode = "Display" et TextOptions.TextRenderingMode = "Aliased" à utiliser.
Cette réponse est bonne, pourquoi quelqu'un l'a rejeté? – asktomsk
+1. Je suis d'accord, cette réponse est certainement juste et je ne peux pas voir une raison pour une downvote. Il ne spécifie pas comment définir TextRenderingMode –