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. Image for the cookie policy date

Draw Image

Hi,
 
Does GridDataControl has a method doing the same as the DrawToBitmap method of the winform's GridGroupingControl?
 
Thanks
 
Yu

4 Replies

SM Saravanan M Syncfusion Team July 4, 2014 10:45 AM UTC

Hi Yu,

We are sorry for Delay causes,

No, GridDataControl does not have the method named as DrawToBitmap . Could you please tell me  which scenario do you want to use this method? If you share your exact scenario, We would suggest alternate way to achieve your requirement.

 Please let us know if you have any queries,

Regards,

Saravnan.M



YU Yu July 6, 2014 09:12 PM UTC

Hi,

Thanks for reply.

The requirement is to provide an email function to email the snapshot image of the grid. When user clicks a toolbar button, an email client will be opened and the snapshot image of the grid will be attached.

Is there a better alternative?

Thanks


YU Yu replied to Saravanan M July 8, 2014 07:12 PM UTC

Hi Yu,

We are sorry for Delay causes,

No, GridDataControl does not have the method named as DrawToBitmap . Could you please tell me  which scenario do you want to use this method? If you share your exact scenario, We would suggest alternate way to achieve your requirement.

 Please let us know if you have any queries,

Regards,

Saravnan.M


Hi, 

Have you had a chance to take a look of the alternatives?

Thanks


AN Ashok N Syncfusion Team July 21, 2014 01:17 PM UTC

Hi Yu,

We are able to convert the only the visible part of the grid to image, we have created a sample for converting visible part of the grid to image, using RenderTargetBitmap class. Please refer the below code snippet for this

private void Button_Click(object sender, RoutedEventArgs e)

{

    RenderTargetBitmap targetBitmap =

    new RenderTargetBitmap((int)datagrid.ActualWidth,

                    (int)datagrid.ActualHeight,

                    96d, 96d,

                    PixelFormats.Default);

    targetBitmap.Render(datagrid);

 

    // add the RenderTargetBitmap to a Bitmapencoder

    BmpBitmapEncoder encoder = new BmpBitmapEncoder();

    encoder.Frames.Add(BitmapFrame.Create(targetBitmap));

 

    // save file to disk

    FileStream fs = File.Open("Grid.bmp", FileMode.OpenOrCreate);

    encoder.Save(fs);

}

We have attached the sample in the below link for your reference, please refer it.

Sample link: http://www.syncfusion.com/downloads/support/directtrac/123670/CS1344771902.zip

Please let us know if you have any queries.

Thanks,
Ashok


Loader.
Live Chat Icon For mobile
Up arrow icon