zoukankan      html  css  js  c++  java
  • 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掉。

  • 相关阅读:
    递归
    二叉树
    IIs 网站应用程序与虚拟目录的区别及高级应用说明(文件分布式存储方案)
    Python时间,日期,时间戳之间转换
    jquery 时间戳和日期时间转化
    javascript 中解析json
    设计模式之单例模式
    深入理解DIP、IoC、DI以及IoC容器
    《大型网站技术架构》读书笔记一:大型网站架构演化
    Key/Value之王Memcached初探:二、Memcached在.Net中的基本操作
  • 原文地址:https://www.cnblogs.com/Jax/p/1096707.html
Copyright © 2011-2022 走看看