/// <summary> /// When the printing events have ended, reset printing variables /// </summary> private void GridDocument_EndPrint(object sender, PrintEventArgs e) { firstPage = true; printer = null; printingTableName = null; GC.Collect(); GC.WaitForPendingFinalizers(); }
/// <summary> /// Printing event called for every page to be printed. /// </summary> private void GridDocument_PrintPage(object sender, PrintPageEventArgs e) { // If this is a new printing session, create a new GridPrinter object. if (firstPage) { printer = new GridPrinter(printingTableName, ref databaseGrid, ref database); firstPage = false; } // Set the current page to be printed. printer.SetPage(ref e); // Print the page. printer.Print(); }
/// <summary> /// Print the selected table. /// </summary> private void gridDocument_PrintPage(object sender, PrintPageEventArgs e) { GridPrinter printer = new GridPrinter(tableName, ref databaseGrid, ref database, e); printer.Print(); }