From c5f2868a9b620303525715edb971a56bd6c384c9 Mon Sep 17 00:00:00 2001 From: DB p Date: Fri, 11 Apr 2025 09:25:45 +0900 Subject: [PATCH] Fix small warning --- .../Converters/QuerySuggestionBoxConverter.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs index ed94771f0..0d6f2e469 100644 --- a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs +++ b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs @@ -1,5 +1,6 @@ using System; using System.Globalization; +using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Media; @@ -43,8 +44,16 @@ public class QuerySuggestionBoxConverter : IMultiValueConverter // Check if Text will be larger than our QueryTextBox Typeface typeface = new Typeface(queryTextBox.FontFamily, queryTextBox.FontStyle, queryTextBox.FontWeight, queryTextBox.FontStretch); - // TODO: Obsolete warning? - var ft = new FormattedText(queryTextBox.Text, CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight, typeface, queryTextBox.FontSize, Brushes.Black); + var dpi = VisualTreeHelper.GetDpi(queryTextBox); + var ft = new FormattedText( + queryTextBox.Text, + CultureInfo.CurrentCulture, + FlowDirection.LeftToRight, + typeface, + queryTextBox.FontSize, + Brushes.Black, + dpi.PixelsPerDip + ); var offset = queryTextBox.Padding.Right;