We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Printing a GridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

27494 Apr 13,2005 11:40 AM Apr 13,2005 07:53 PM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On April 13, 2005 11:40 AM

Hi, can you tell me what i would have to do to print a GGC with only it''s width fitted onto a page ? I only found samples to either simply print the grid or to fit the whole grid on one page. thank you

Administrator [Syncfusion]
Replied On April 13, 2005 07:53 PM

One way you can do this is to print a bitmap that is scaled to fit in the target rectangle. The sample does this for a GridControl. \Essential Suite\3.0.1.0\Windows\Grid.Windows\Samples\In Depth\PrintToFit\ You can use something similar to do it for a GridGroupingControl. Here is some button handler code that shows how you can get a bitmap of a GridGroupingControl through its TableCOntrol. Form f = new Form(); GridModel gridControl1 = this.gridGroupingControl1.TableControl.Model; //draw a fullsize bitmap of the grid... int gridHeight = gridControl1.RowHeights.GetTotal(0, gridControl1.RowCount); int gridWidth = gridControl1.ColWidths.GetTotal(0, gridControl1.ColCount); Bitmap gridBM = new Bitmap(gridWidth, gridHeight); Graphics g = Graphics.FromImage(gridBM); Rectangle saveGridRect = gridControl1.ActiveGridView.GridBounds; gridControl1.ActiveGridView.GridBounds = new Rectangle(0, 0, gridWidth, gridHeight); gridControl1.ActiveGridView.DrawGrid(g); gridControl1.ActiveGridView.ResetGridBounds(); g.Dispose(); //create a bitmap the the proper target size Bitmap picBM = new Bitmap(f.Size.Width, f.Size.Height ); //draw grid bitmap into the new bitmap... System.Drawing.GraphicsUnit gu = System.Drawing.GraphicsUnit.Point; g = Graphics.FromImage(picBM); RectangleF srcRect = gridBM.GetBounds(ref gu); Rectangle destRect = new Rectangle(0, 0, picBM.Width, picBM.Height); g.DrawImage(gridBM, destRect, srcRect, gu); g.Dispose(); //show the new bitmap f.BackgroundImage = picBM; f.Show();

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;