This commit is contained in:
2025-10-03 09:04:40 +08:00
parent 752901dbb9
commit 3509036d85
2 changed files with 30 additions and 2 deletions
+2 -2
View File
@@ -1467,8 +1467,8 @@
<Border ClipToBounds="True" Width="324" Height="182">
<Grid>
<Image Source="Resources/PresentationExample/page.jpg" Width="324" Height="182" Stretch="Fill"></Image>
<Image Source="Resources/PresentationExample/toolbar.png" Height="16" Width="324"
VerticalAlignment="Bottom" HorizontalAlignment="Center" Stretch="Fill" />
<Image Name="PPTBtnPreviewToolbar" Source="Resources/PresentationExample/toolbar.png" Height="16" Width="324"
VerticalAlignment="Bottom" HorizontalAlignment="Center" Stretch="Uniform" />
<Image Name="PPTBtnPreviewLS" Source="Resources/PresentationExample/sidebar-white.png" Width="10" Height="30"
VerticalAlignment="Center" HorizontalAlignment="Left" RenderTransformOrigin="0.5,0.5" Stretch="Fill">
<Image.RenderTransform>
+28
View File
@@ -1054,6 +1054,34 @@ namespace Ink_Canvas
PPTBtnPreviewLBTransform.X = scaledMarginOffset + (lbPosition * scaleX);
PPTBtnPreviewRBTransform.X = -(scaledMarginOffset + (rbPosition * scaleX));
// 计算工具栏尺寸
var dpiScaleX = 1.0;
var dpiScaleY = 1.0;
try
{
var source = PresentationSource.FromVisual(this);
if (source?.CompositionTarget != null)
{
var transform = source.CompositionTarget.TransformToDevice;
dpiScaleX = transform.M11;
dpiScaleY = transform.M22;
}
}
catch
{
dpiScaleX = 1.0;
dpiScaleY = 1.0;
}
// 计算工具栏的实际尺寸
const double baseToolbarHeight = 20.0;
double actualToolbarHeight = baseToolbarHeight * dpiScaleY;
double scaledToolbarHeight = actualToolbarHeight * scaleY;
// 设置工具栏尺寸
PPTBtnPreviewToolbar.Height = scaledToolbarHeight;
PPTBtnPreviewToolbar.Width = previewWidth;
}
private void ToggleSwitchShowCursor_Toggled(object sender, RoutedEventArgs e)