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.

Unable to get GridControl.DrawGrid to produce bitmap

Thread ID:

Created:

Updated:

Platform:

Replies:

32836 Aug 8,2005 04:44 PM Aug 8,2005 06:30 PM Windows Forms 1
loading
Tags: GridControl
Robert Linder
Asked On August 8, 2005 04:44 PM

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 06:30 PM

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

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.

;