MultiGridPrinting
--------------------------------------------------------------------------------
Shows how you can print multiple grids into a single document.

The C1FlexGrid has a Print method that prints the grid. The Print method allows
you to specify basic printing parameters such as document title, margins, and
scaling mode. The Print method is the easy way to provide basic printing.

If you need more flexibility, the C1FlexGrid also provides a GetPageImages 
method that returns a list of images that represent a paged view of the grid.
These images can then be added to pages in a PrintDocument to print the grid 
by itself or in combination with other elements.

The sample shows how you can use the GetPageImages method to render multiple
grids into a single document.

The sample achieves this by creating a PrintDocument object and implementing
a handler for the PrintPage event that creates images for all the grids that
have to be rendered.

This is the event handler implementation:

<code>
        void pd_PrintPage(object sender, PrintPageEventArgs e)
        {
            if (_pages == null)
            {
                // calculate page size, discounting margins
                var sz = e.PrintableArea;
                sz.Width -= 2 * _margin;
                sz.Height -= 2 * _margin;

                // generate images for every page
                _currentPage = 0;
                _pages = new List<FrameworkElement>();

                // print first grid
                foreach (var page in _flex.GetPageImages(_scaleMode, sz, 100))
                {
                    _pages.Add(page);
                }

                // print second grid
                foreach (var page in _flex2.GetPageImages(_scaleMode, sz, 100))
                {
                    _pages.Add(page);
                }
            }

            // create page element
            var pageTemplate = new PageTemplate();

            // set margins
            pageTemplate.SetPageMargin(new Thickness(_margin));

            // set content
            pageTemplate.PageContent.Child = _pages[_currentPage];
            pageTemplate.PageContent.Stretch = _scaleMode == ScaleMode.ActualSize
                ? System.Windows.Media.Stretch.None
                : System.Windows.Media.Stretch.Uniform;

            // set footer text
            pageTemplate.FooterRight.Text = string.Format("Page {0} of {1}", 
                _currentPage + 1, _pages.Count);

            // render this page
            e.PageVisual = pageTemplate;

            // move on to next page
            _currentPage++;
            e.HasMorePages = _currentPage < _pages.Count;
        }
</code>