标题:[求助]怎样实现打印预览和打印DataGrid中的数据???
只看楼主
xinghun868
Rank: 1
等 级:新手上路
帖 子:62
专家分:0
注 册:2007-6-1
 问题点数:0 回复次数:4 
[求助]怎样实现打印预览和打印DataGrid中的数据???

请教各位大侠~~~~

搜索更多相关主题的帖子: DataGrid 数据 打印 预览 
2007-10-28 22:42
助人为乐
Rank: 1
等 级:新手上路
帖 子:54
专家分:0
注 册:2007-3-9
得分:0 
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 miPrintPreview;
private System.Windows.Forms.MenuItem miPrint;
private System.Windows.Forms.MenuItem menuItem4;
private System.Windows.Forms.MenuItem miExit;
private System.Windows.Forms.DataGridTableStyle dgtsCustomers;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn1;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn2;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn3;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn4;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn6;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn7;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn8;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn9;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn10;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn11;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn5;
private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
private System.Data.SqlClient.SqlConnection sqlConnection1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
2007-10-29 06:50
bygg
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:乖乖的心中
等 级:版主
威 望:241
帖 子:13555
专家分:3076
注 册:2006-10-23
得分:0 
可以利用WEB的打印功能来打印页面.也可以把要打印的数据显示在报表中..

飘过~~
2007-10-29 12:58
菜鳥弎魛
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2007-10-24
得分:0 

我以前写过一个这样一来的程序,我是用直接画的方式实现的,是win,如果是web就好办了,就是非颠倒楼的方法


個人主頁: www.zw. email: zw_@ QQ:379868872
2007-10-30 11:16
菜鳥弎魛
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2007-10-24
得分:0 

不好意思,字打错了 "非颠倒楼"="3楼"


個人主頁: www.zw. email: zw_@ QQ:379868872
2007-10-30 11:17



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-181532-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.362832 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved