Skip to content

Instantly share code, notes, and snippets.

@tamr
Created March 24, 2023 20:43
Show Gist options
  • Save tamr/301a4a3ad23a5dd39f359dfc1cae3a56 to your computer and use it in GitHub Desktop.
Save tamr/301a4a3ad23a5dd39f359dfc1cae3a56 to your computer and use it in GitHub Desktop.
Completely disable anti-aliasing in AstroGrep v4.4.8
WinformsGUI/Windows/Controls/AvalonEdit/CustomLineNumberMargin.cs | 4 ++--
WinformsGUI/Windows/Controls/AvalonEdit/TextEditorEx.cs | 4 +++-
WinformsGUI/Windows/Forms/frmMain.cs | 2 ++
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/WinformsGUI/Windows/Controls/AvalonEdit/CustomLineNumberMargin.cs b/WinformsGUI/Windows/Controls/AvalonEdit/CustomLineNumberMargin.cs
index bc55bd2..82f9a49 100644
--- a/WinformsGUI/Windows/Controls/AvalonEdit/CustomLineNumberMargin.cs
+++ b/WinformsGUI/Windows/Controls/AvalonEdit/CustomLineNumberMargin.cs
@@ -191,8 +191,8 @@ namespace AstroGrep.Windows.Controls
emSize.Value,
foreground,
null,
- TextOptions.GetTextFormattingMode(element)
- );
+ TextFormattingMode.Display
+ );
}
/// <summary>
diff --git a/WinformsGUI/Windows/Controls/AvalonEdit/TextEditorEx.cs b/WinformsGUI/Windows/Controls/AvalonEdit/TextEditorEx.cs
index 934bb30..b48f85b 100644
--- a/WinformsGUI/Windows/Controls/AvalonEdit/TextEditorEx.cs
+++ b/WinformsGUI/Windows/Controls/AvalonEdit/TextEditorEx.cs
@@ -80,7 +80,9 @@ namespace AstroGrep.Windows.Controls
// set initial font size to calculate zoom values
FontSize = base.FontSize;
- }
+
+ TextOptions.SetTextFormattingMode(this, TextFormattingMode.Display);
+ }
#region Public Properties
diff --git a/WinformsGUI/Windows/Forms/frmMain.cs b/WinformsGUI/Windows/Forms/frmMain.cs
index b48cb2a..649cf2e 100644
--- a/WinformsGUI/Windows/Forms/frmMain.cs
+++ b/WinformsGUI/Windows/Forms/frmMain.cs
@@ -201,6 +201,8 @@ namespace AstroGrep.Windows.Forms
var menu = new System.Windows.Controls.ContextMenu();
var item = new System.Windows.Controls.MenuItem();
+ System.Windows.Media.TextOptions.SetTextFormattingMode(menu, System.Windows.Media.TextFormattingMode.Display);
+
item.Click += openFile_Click;
item.Header = Language.GetGenericText("ResultsContextMenu.OpenFileCurrentLine");
item.IsEnabled = false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment