• C# DGVPrinter.cs 打印方法


    Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 //
    // Printing the DataGridView Control
    // in response to a toolbar button press – the myprintsettings and mypagesettings objects are objects used by the local
    // program to save printer and page settings
    //
    private void printToolStripButton_Click(object sender, EventArgs e)
    {
    DGVPrinter printer = new DGVPrinter();
    printer.Title = "DataGridView Report";
    printer.SubTitle = "An Easy to Use DataGridView Printing Object";
    printer.SubTitleFormatFlags = StringFormatFlags.LineLimit |
    StringFormatFlags.NoClip;
    printer.PageNumbers = true;
    printer.PageNumberInHeader = false;
    printer.PorportionalColumns = true;
    printer.HeaderCellAlignment = StringAlignment.Near;
    printer.Footer = "Your Company Name Here";
    printer.FooterSpacing = 15;
    // use saved settings
    if (null != myprintsettings)
    printer.PrintDocument.PrinterSettings = myprintsettings;
    if (null != mypagesettings)
    printer.PrintDocument.DefaultPageSettings = mypagesettings;
    if (DialogResult.OK == printer.DisplayPrintDialog()) // replace DisplayPrintDialog() with your own print dialog
    {
    // save users' settings
    myprintsettings = printer.PrinterSettings;
    mypagesettings = printer.PageSettings;
    // print without displaying the printdialog
    printer.PrintNoDisplay(datagridviewControl);
    }

    ////////////////////////////////////////

    Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 //
    // Printing the DataGridView Control
    // in response to a toolbar button press
    //
    private void printToolStripButton_Click(object sender, EventArgs e)
    {
    DGVPrinter printer = new DGVPrinter();
    printer.Title = "DataGridView Report";
    printer.SubTitle = "An Easy to Use DataGridView Printing Object";
    printer.SubTitleFormatFlags = StringFormatFlags.LineLimit |
    StringFormatFlags.NoClip;
    printer.PageNumbers = true;
    printer.PageNumberInHeader = false;
    printer.PorportionalColumns = true;
    printer.HeaderCellAlignment = StringAlignment.Near;
    printer.Footer = "Your Company Name Here";
    printer.FooterSpacing = 15;
    printer.PrintDataGridView(datagridviewControl);
    }

  • 相关阅读:
    www.insidesql.org
    kevinekline----------------- SQLSERVER MVP
    Sys.dm_os_wait_stats Sys.dm_performance_counters
    如何使用 DBCC MEMORYSTATUS 命令来监视 SQL Server 2005 中的内存使用情况
    VITAM POST MORTEM – ANALYZING DEADLOCKED SCHEDULERS MINI DUMP FROM SQL SERVER
    Cargo, Rust’s Package Manager
    建筑识图入门(初学者 入门)
    Tracing SQL Queries in Real Time for MySQL Databases using WinDbg and Basic Assembler Knowledge
    Microsoft SQL Server R Services
    The Rambling DBA: Jonathan Kehayias
  • 原文地址:https://www.cnblogs.com/ilookbo/p/5829140.html
Copyright © 2020-2023  润新知