-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMainWindowUIScaling.cs
41 lines (36 loc) · 1.4 KB
/
MainWindowUIScaling.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System.Windows.Input;
using System.Windows;
namespace ESPEDfGK
{
public partial class MainWindow : Window
{
//******************************************************************************************************************
private void setUIscale(double uiscale)
{
uiScaler.ScaleX = uiscale;
uiScaler.ScaleY = uiscale;
konfiguration.UIScale = uiscale;
}
//******************************************************************************************************************
protected override void OnPreviewMouseWheel(MouseWheelEventArgs args)
{
base.OnPreviewMouseWheel(args);
if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
{
setUIscale(uiScaler.ScaleX + ((args.Delta > 0) ? 0.1 : -0.1));
}
}
//******************************************************************************************************************
protected override void OnPreviewMouseDown(MouseButtonEventArgs args)
{
base.OnPreviewMouseDown(args);
if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
{
if (args.MiddleButton == MouseButtonState.Pressed)
{
setUIscale(1.0);
}
}
}
}
}