Xtreme Visual Basic Talk

Xtreme Visual Basic Talk (http://www.xtremevbtalk.com/)
-   Code Library (http://www.xtremevbtalk.com/code-library/)
-   -   Print / Print Preview datagrid (http://www.xtremevbtalk.com/code-library/246380-print-print-preview-datagrid.html)

Merrion 12-01-2005 08:02 AM

Print / Print Preview datagrid
 
This class allows you to print data grids across multiple pages (both multiple pages across and down...) and to specify a header, column header styles, footer etc.

There is an article on the code project that explains the details...

Merrion 04-06-2006 02:15 PM

1 Attachment(s)
New release that allows you to span the grid across multiple pages and also fixes a bug (which was causing the last column to overflow when it would actually fit...)

Merrion 09-03-2007 07:10 AM

1 Attachment(s)
New release
(1) Can print DataGridView as well as DataGrid controls
(2) Has event to allow you to change the colours of individual cells
Code:

    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
Code:

    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



All times are GMT -6. The time now is 03:17 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Optimisation provided by DragonByte SEO v2.0.15 (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.