• WPF SDK研究 Printing (1) PrintDialog


    PrintDialog
        This sample illustrates how to create an instance of a simple PrintDialog and then display it. The sample uses both Extensible Application Markup Language (XAML) and procedural code. 
        使用PrintDialog显示打印机设置(ShowDialog方法),以及可打印区域的width/height:

        3个按钮对应的function如下:
            public void InvokePrint(object sender, RoutedEventArgs e)
                
    {
                    PrintDialog pDialog 
    = new PrintDialog();
                    pDialog.PageRangeSelection 
    = PageRangeSelection.AllPages;
                    pDialog.UserPageRangeEnabled 
    = true;
                    pDialog.ShowDialog();
                }

            
    public void GetHeight(object sender, RoutedEventArgs e)
            
    {
                PrintDialog pDialog 
    = new PrintDialog();
                PrintTicket pt 
    = pDialog.PrintTicket;   //force initialization of the dialog's PrintTicket or PrintQueue
                txt1.Text = pDialog.PrintableAreaHeight.ToString() + " is the printable height";
            }

            
    public void GetWidth(object sender, RoutedEventArgs e)
            
    {
                PrintDialog pDialog 
    = new PrintDialog();
                PrintQueue pq 
    = pDialog.PrintQueue;     //force initialization of the dialog's PrintTicket or PrintQueue
                txt2.Text = pDialog.PrintableAreaWidth.ToString() + " is the printable width";
            }


    对于PrintDialog,大家并不陌生。而PrintQueue和PrintTicket则是NET3.5新增的两个类。在这个Sample中,这两个类并没有起到任何作用,甚至可以mark掉。

  • 相关阅读:
    php 给图片添加文字水印 可控制位置,旋转,多行文字
    太多的用户请求,网站出现了504
    这些问题,你注意了吗?
    ubuntu 系统环境配置记录
    node.js开发指南中出现的问题 has no method 'router'解决办法
    在nodejs express 中使用session的功能
    更改窗口大小,重新加载微博发布框
    原生js控制audio标签自动播放
    利用css3转换transform画五星红旗
    css3+js旗帜飘动
  • 原文地址:https://www.cnblogs.com/Jax/p/1096707.html
Copyright © 2020-2023  润新知