将DataGridView数据打印

Public Class dayreport1    Inherits System.Windows.Forms.Form    Private TableFont As New Font("宋体", 9)           当前要打印文本的字体及字号     Private HeadFont As New Font("黑体", 12, FontStyle.Underline) 表头字体
摘要由CSDN通过智能技术生成

Public Class dayreport1
    Inherits System.Windows.Forms.Form

    Private TableFont As New Font("宋体", 9)           '当前要打印文本的字体及字号
    Private HeadFont As New Font("黑体", 12, FontStyle.Underline) '表头字体
    Private SubHeadFont As New Font("楷体_GB2312", 10, FontStyle.Regular) '副表头字体
    Private HeadText As String   '表头文字
    Private SubHeadLeftText As String  '副表头左文字
    Private SubHeadRightText As String  '副表头右文字
    Private HeadHeight As Integer = 40 '表头高度
    Private SubHeadHeight As Integer = 30 '副表头高度
    Private FootFont As New Font("黑体", 12, FontStyle.Underline) '表脚字体
    Private SubFootFont As New Font("楷体_GB2312", 10, FontStyle.Regular) '副表脚字体
    Private FootText As String  '表脚文字
    Private SubFootLeftText As String  '副表脚左文字
    Private SubfootRightText As String
    Private FootHeight As Integer = 40 '表脚高度
    Private SubFootHeight As Integer = 30 '副表脚高度
    Dim X_unit As Integer                               '表的基本单位
    Dim Y_unit As Integer = TableFont.Height * 2.5

    '以下为模块内部使用
    Private ev As Printing.PrintPageEventArgs
    Private DataGridColumn As DataColumn
    Private DataGridRow As DataRow
    Private DataTable1 As DataTable
    Private Cols As Integer                             '当前要打印的列
    Private Rows As Integer = 0                         '当前要打印的行
    Private ColsCount As Integer                        '当前DATAGRID共有多少列
    Private PrintingLineNumber As Integer = 0           '当前正要打印的行号
    Private PageRecordNumber As Integer                 '当前要所要打印的记录行数,由计算得到.
    Private PrintingPageNumber As Integer = 0           '正要打印的页号
    Private PageNumber As Integer                       '共需要打印的页数
    Private PrintRecordLeave As Integer                 '当前还有多少页没有打印
    Private PrintRecordComplete As Integer = 0         '已经打印完的记录数
    Private Pleft As Integer
    Private Ptop As Integer
    Private Pright As Integer
    Private Pbottom As Integer
    Private Pwidth As Integer
    Private Pheigh As Integer

    Private DrawBrush As New SolidBrush(System.Drawing.Color.Black)     '当前画笔颜色
    Private PrintRecordNumber As Integer '每页打印的记录条数
    Private Totalpage As Integer '总共应该打印的页数
    '用户自定义字体及字号
    Public WriteOnly Property SetTableFont() As System.Drawing.Font
        Set(ByVal Value As System.Drawing.Font)
            TableFont = Value
        End Set
    End Property
    Public WriteOnly Property SetHeadFont() As System.Drawing.Font
        Set(ByVal Value As System.Drawing.Font)
            HeadFont = Value
        End Set
    End Property
    Public WriteOnly Property SetSubHeadFont() As System.Drawing.Font
        Set(ByVal Value As System.Drawing.Font)
            SubHeadFont = Value
        End Set
    End Property
    Public WriteOnly Property SetFootFont() As System.Drawing.Font
        Set(ByVal Value As System.Drawing.Font)<

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值