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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Unable to get GridControl.DrawGrid to produce bitmap

Thread ID:





32836 Aug 8,2005 08:44 PM UTC Aug 8,2005 10:30 PM UTC WinForms 1
Tags: GridControl
Robert Linder
Asked On August 8, 2005 08:44 PM UTC

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); } }

Administrator [Syncfusion]
Replied On 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\\Windows\Grid.Windows\Samples\In Depth\PrintToFit


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon