Public Class FormMul
    Private myprintstyle As Integer = 0
    Private Sub 订单BindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Validate()
        Me.订单BindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.NorthwindDataSet)

    End Sub

    Private Sub FormMul_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: 这行代码将数据加载到表“NorthwindDataSet.供应商”中。您可以根据需要移动或移除它。
        'TODO: 这行代码将数据加载到表“NorthwindDataSet.订单”中。您可以根据需要移动或移除它。
        Me.订单TableAdapter.Fill(Me.NorthwindDataSet.订单)
        Me.供应商TableAdapter.Fill(Me.NorthwindDataSet.供应商)




        d1.Columns(1).HeaderCell.Style.BackColor = Color.Blue
        d1.Columns(1).HeaderCell.Style.ForeColor = Color.Red
        d1.Columns(1).HeaderCell.Style.Font = New Font("黑体", 13, FontStyle.Bold)
        d1.Columns(3).HeaderCell.Style.BackColor = Color.Red

        d1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells)
        For i As Integer = 0 To d1.ColumnCount - 1
            d1.Columns(i).Tag = "合并"
        Next
        d1.RefreshMergeSetting() '刷新并显示合并结果
        myp.InvalidatePreview()

    End Sub


    


    Private Sub VB2008Print1_HeaderFooterOut(ByVal pages As Integer, ByVal curpage As Integer) Handles myp.HeaderFooterOut
        myp.PrintFooter("608研究所", "第 " & CStr(curpage) & " 页 共 " & CStr(pages) & " 页", "")
        myp.PrintHeader("中国", "湖南 株洲", "", New Font("华文行楷", 10, FontStyle.Bold), Color.Red)
    End Sub

    Private Sub VB2008Print1_PrintDocument() Handles myp.PrintDocument
        myp.NewPage()
        Dim ss As String
        ss = "从5.3版起，MulHeaderDataGridView组件具有单元格内容合并显示功能（方法是通过设置单元格内容的合并标识），打印控件也可以以单元格内容合并方式打印，但目前，MulHeaderDataGridView组件"
        ss = ss & "的单元格内容合并仅限静态的，并不支持动态单元格内容合并显示，即单元格内容合并仅用于显示，而不适用于数据编辑"
        Dim txtfont As New Font("宋体", 12, FontStyle.Bold)
        Dim titlefont As New Font("黑体", 18, FontStyle.Bold Or FontStyle.Underline)
        myp.DrawText(ss, txtfont, 0)
        myp.NewRow(myp.LastDrawTextHeight)
        myp.DrawTitle("以下是下面显示的那个MulHeaderDataGridView单元格内容合并打印的结果", titlefont, Color.Blue, 0)

        myp.PrintDGV(d1, "单元格内容合并打印测试", titlefont, StringAlignment.Center, "1111", True, True, 0, True, True, 0, 0, True, d1.ColHeaderTreeView)

    End Sub




  
    Private Sub d1_Sorted(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles d1.Sorted
        d1.RefreshMergeSetting()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        myp.InvalidatePreview()
    End Sub
End Class