wpf .net core6.0 图片打印预览,可以拖拽位置,滚轮放大缩小,打印

接上一篇生成二维码,这篇就是里面的图片预览并且打印

<Window x:Class="程序名.PrintPreviewWin"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
        BorderThickness="0" AllowsTransparency="True"  ResizeMode="CanResize" Background="Transparent"
        BorderBrush="Transparent" WindowStartupLocation="CenterScreen" WindowStyle="None"
        FontSize="28" Height="800" Width="600">
    <Border Background="#FFFFFFFF" CornerRadius="6" Margin="5">
        <Border.Effect>
            <DropShadowEffect Opacity="1" Direction="0" BlurRadius="10" ShadowDepth="0"/>
        </Border.Effect>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="38"></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>
            <Border Background="#f0f0f0" />
            <Button Margin="10 0 0 0" Width="80" Height="48" HorizontalAlignment="Left"
                    Style="{StaticResource BlueButton}" Content="打印" FontSize="12"
                    Command="{Binding PrintCommand}" CommandParameter="{Binding ElementName=border}"/>
            <Image Source="/Images/Login/Close.png" Stretch="None" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0">
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="PreviewMouseUp">
                        <i:InvokeCommandAction Command="{Binding CloseCommand}"
                                                   CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}" />
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </Image>
            <Viewbox Stretch="Uniform" Grid.Row="1">
                <Border Background="#a0a0a0">
      &n
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值