View Single Post
Old 09-03-2007, 07:10 AM
Merrion's Avatar
Merrion Merrion is offline
Ultimate Contributor

* Guru *
Join Date: Sep 2001
Location: Dublin, Ireland
Posts: 1,828

New release
(1) Can print DataGridView as well as DataGrid controls
(2) Has event to allow you to change the colours of individual cells
    Private Sub GridPrinter_QueryCellFormat(ByVal sender As Object, ByVal e As QueryCellFormatEventArgs) Handles GridPrinter.QueryCellFormat

        '\\ Top 2 clubs go up
        If e.RowNumber <= 2 Then
            e.BackgroundColour = Brushes.AliceBlue
        End If

        If e.ColumnNumber = 0 Then
            If e.CellData.ToString = "Grimsby" Then
                e.TextColour = Brushes.RoyalBlue
            End If
        End If

        '\\ Bottom 2 columns relegation
        If e.RowNumber >= 23 Then
            e.BackgroundColour = Brushes.LightGray
        End If
    End Sub
(3) Has an event to allow you to change the text in a cell
    Private Sub GridPrinter_QueryCellData(ByVal sender As Object, ByVal e As QueryCellDataEventArgs) Handles GridPrinter.QueryCellData

        If e.ColumnNumber > 0 And e.CellText = "0" Then
            e.CellText = "Zero"
        End If
    End Sub
Attached Files
File Type: zip (78.0 KB, 282 views)
Reply With Quote