The Syncfusion® native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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
ADAdministrator Syncfusion Team April 13, 2005 11:53 PM UTC
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();