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.
Hello,
I am trying to create a bitmap using GridControl.DrawGrid.
ontraTable.LoadTableForDisplaying collects data from Access database and translate the data into GridControl. I am able to see the GridControl on a Windows form with proper coloring.
The second part of the program needs to produces a bitmap that will be painted on Graphics object.
I tried to save the bitmap ''_bitmap.Save("C:\tmp.jpg", ImageFormat.Jpeg );''
I got the following:
An unhandled exception of type ''System.Runtime.InteropServices.ExternalException'' occurred in system.drawing.dll
Additional information: A generic error occurred in GDI+.
---Code---
GridControl OntraTableGrid = new GridControl();
ActorTable ontraTable = new ActorTable();
ontraTable.LoadTableForDisplaying( asset.Name , OntraTableGrid, asset.FileName );
using ( Bitmap gridBM = new Bitmap(asset.Bounds.Width, asset.Bounds.Height) )
{
using ( Graphics g = Graphics.FromImage(gridBM))
{
OntraTableGrid.DrawGrid( g );
return new Bitmap(asset.Bounds.Width,asset.Bounds.Height,g);
}
}
ADAdministrator Syncfusion Team August 8, 2005 10:30 PM UTC
Can you display the bitmap in a PictureBox (just not able to save it)?
Just something to try. Before saving the bitmap, try calling bitmap1.MakeTransparent and explicitly set some tranparent color.
This sample shows how you can create a bitmap using DrawGrid. The code looks similar to what you are doing.
\Syncfusion\Essential Studio\3.2.1.0\Windows\Grid.Windows\Samples\In Depth\PrintToFit