小编phi*_*dry的帖子

PrintFixedDocument wpf打印质量 - Windows 10/8 vs Windows 7

我目前正在尝试使用PrintFixedDocument打印内容容器的内容(它只包含带有信息的数据网格)和图像.它可以完美地打印在我的机器(Windows 10)上,具有完整的图像质量,而另一台PC是Windows 8,质量是一样的.

但是,当在Windows 7 PC上完成时,图像质量变得非常差,最终结果非常模糊.这是一个问题,因为计算机由于各种原因无法从Windows 7更新,所以我想知道是否有其他人经历过这个,如果有的话有解决方法吗?也可能是我的GetFixedDocument方法的一个问题,虽然我无法弄清楚为什么这对win 10和8都有效,但不是7.

注意这是从每台PC上的应用程序的安装版本运行

还在所有3个操作系统上的多个打印机上进行了测试

任何帮助,将不胜感激

XAML:

            <StackPanel Margin="-105,146,66,0" Height="900" VerticalAlignment="Top"  x:Name="PrintImageContextMenu">
                <Image Canvas.ZIndex="0" Source="{Binding Coupon.OverlayImagePath}"  Margin="0,-21,-76,108" Stretch="Fill"  />

                <ContentControl Content="{Binding}"  ContentTemplateSelector="{StaticResource DataViewerDataTemplateSelector}"  />

            </StackPanel>
Run Code Online (Sandbox Code Playgroud)

C#:public partial class CouponViewerView {public CouponViewerView(){InitializeComponent(); }

    public void Print()
    {
        //Executes On Thread
        Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (EventHandler)delegate
        {
            UpdateLayout();

            var fixedDoc = PrintHelper.GetFixedDocument(StackPanelToPrint, new PrintDialog());

            PrintHelper.ShowPrintPreview(fixedDoc);


        }, null, null);



    }

    private void PrintCurrentForm(object sender, RoutedEventArgs e)
    {
        Print();
    }
Run Code Online (Sandbox Code Playgroud)

C#打印助手代码:

 public static void ShowPrintPreview(FixedDocument fixedDoc)
        {
            var wnd …
Run Code Online (Sandbox Code Playgroud)

c# windows wpf xaml

10
推荐指数
1
解决办法
891
查看次数

标签 统计

c# ×1

windows ×1

wpf ×1

xaml ×1