5.1.0.5: Scaling gefixt, maxwidth binding aus gridToday entfernt
This commit is contained in:
parent
7477d8a130
commit
a658357c7e
@ -1,4 +1,5 @@
|
||||
using Microsoft.Win32;
|
||||
using MahApps.Metro.Controls;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@ -36,6 +37,7 @@ namespace ZKuP
|
||||
{
|
||||
public static double width = 0;
|
||||
public static double height = 0;
|
||||
public static double scale = 0;
|
||||
public static bool? IsFileLocked(FileInfo file)
|
||||
{
|
||||
try
|
||||
@ -809,9 +811,18 @@ namespace ZKuP
|
||||
return GetCell(grid, rowContainer, column);
|
||||
}
|
||||
|
||||
|
||||
internal static void initScaler(double Width, double Height)
|
||||
{
|
||||
width = Width;
|
||||
height = Height;
|
||||
}
|
||||
|
||||
static double lastDpiScale = -1;
|
||||
static bool _isCurrentlyScaled = false;
|
||||
internal static async void CheckScale(Window mainWindow)
|
||||
{
|
||||
if (!(width == 0 || height == 0))
|
||||
{
|
||||
var dpi = VisualTreeHelper.GetDpi(mainWindow);
|
||||
double dpiScale = dpi.DpiScaleX; // or DpiScaleY
|
||||
@ -827,12 +838,12 @@ namespace ZKuP
|
||||
|
||||
lastDpiScale = dpiScale;
|
||||
|
||||
if (needsScaling)
|
||||
if (needsScaling && !_isCurrentlyScaled)
|
||||
{
|
||||
// Calculate the scale to fit in working area
|
||||
double scaleX = workingArea.Width / width;
|
||||
double scaleY = workingArea.Height / height;
|
||||
double scale = Math.Min(scaleX, scaleY);
|
||||
double scaleX = width / workingArea.Width;
|
||||
double scaleY = height / workingArea.Height;
|
||||
scale = Math.Min(scaleX, scaleY);
|
||||
|
||||
scale = Math.Round(scale * 4) / 4.0;
|
||||
|
||||
@ -840,6 +851,7 @@ namespace ZKuP
|
||||
mainWindow.MinHeight = scale * height;
|
||||
mainWindow.LayoutTransform = new ScaleTransform(scale, scale);
|
||||
|
||||
|
||||
mainWindow.Width = mainWindow.MinWidth;
|
||||
mainWindow.Height = mainWindow.MinHeight;
|
||||
|
||||
@ -847,7 +859,7 @@ namespace ZKuP
|
||||
TextOptions.SetTextRenderingMode(mainWindow, TextRenderingMode.ClearType);
|
||||
_isCurrentlyScaled = true;
|
||||
}
|
||||
else if (_isCurrentlyScaled)
|
||||
else if (_isCurrentlyScaled && !needsScaling)
|
||||
{
|
||||
// Reset to normal scale
|
||||
mainWindow.LayoutTransform = Transform.Identity;
|
||||
@ -857,6 +869,9 @@ namespace ZKuP
|
||||
|
||||
TextOptions.SetTextFormattingMode(mainWindow, TextFormattingMode.Ideal);
|
||||
TextOptions.SetTextRenderingMode(mainWindow, TextRenderingMode.Auto);
|
||||
|
||||
_isCurrentlyScaled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -607,7 +607,7 @@
|
||||
</Grid>
|
||||
|
||||
|
||||
<Grid x:Name="gridToday" Grid.Row="1" Visibility="Collapsed" VerticalAlignment="Stretch" MinHeight="100" Margin="0,-10,0,0" MaxWidth="{Binding ActualWidth, ElementName=metroWindow, Mode=OneWay}">
|
||||
<Grid x:Name="gridToday" Grid.Row="1" Visibility="Collapsed" VerticalAlignment="Stretch" MinHeight="100" Margin="0,-10,0,0" >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition x:Name="columnLeft" Width="1.456*" MinWidth="1000"/>
|
||||
<ColumnDefinition Width="15"/>
|
||||
|
||||
@ -43,7 +43,7 @@ namespace ZKuP
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
public const string Version = "5.1.0.4";
|
||||
public const string Version = "5.1.0.5";
|
||||
public static Roles LoggedInRole { get; private set; } = Roles.None;
|
||||
|
||||
|
||||
@ -291,8 +291,7 @@ namespace ZKuP
|
||||
if (actualheight <= 191) gridBackground.RowDefinitions[1].Height = new GridLength(maxheight);
|
||||
|
||||
//gridSpinner.Visibility = Visibility.Collapsed;
|
||||
Helper.width = this.MinWidth;
|
||||
Helper.height = this.MinHeight;
|
||||
Helper.initScaler(this.MinWidth, this.MinHeight);
|
||||
|
||||
|
||||
connTimer.Interval = TimeSpan.FromSeconds(2);
|
||||
@ -3038,10 +3037,10 @@ namespace ZKuP
|
||||
|
||||
Point splitterPosition = splitter.TransformToAncestor(window).Transform(new Point(0, 0));
|
||||
|
||||
if (splitterPosition.Y > (this.ActualHeight - 190))
|
||||
if (splitterPosition.Y > ((this.ActualHeight - 190) / Helper.scale))
|
||||
{
|
||||
e.Handled = true; // Bewegung stoppen
|
||||
gridRowTop.Height = new GridLength(this.ActualHeight - 160 - 190);
|
||||
gridRowTop.Height = new GridLength((this.ActualHeight - 160 - 190) / Helper.scale);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user