您正在看的C语言系列是:在C#里实现DATAGRID的打印预览和打印。
很多人都在论坛里问,如何实现DATAGRID的打印预览和打印,现在我就把这方面的源代码告诉大家。这段代码也花费了我1个晚上的时间,呵呵!数据库是基于
SQL server2000自带的northwind。源代码如下:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.
Windows.Forms;
using System.Data;
using System.Data.OleDb;
namespace DataGridPrint
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.
Windows.Forms.Form
{
private System.
Windows.Forms.Panel panel1;
private System.
Windows.Forms.DataGrid dgTest;
private System.
Windows.Forms.Button
btnFillDataGrid;
private System.
Windows.Forms.MainMenu mnuFile;
private System.
Windows.Forms.MenuItem menuItem1;
private System.
Windows.Forms.MenuItem miPrintPrev
iew;
private System.
Windows.Forms.MenuItem miPrint;
private System.
Windows.Forms.MenuItem menuItem4;
private System.
Windows.Forms.MenuItem m
iexit;
private System.
Windows.Forms.DataGridTableStyle dgtsCustomers;
private System.
Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn1;
private System.
Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn2;
private System.
Windows.Fo
1 2 3 4 5 6 7 8 9 10 ...
下一页 >>