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.

Draw Image

Thread ID:

Created:

Updated:

Platform:

Replies:

116919 Jun 30,2014 06:55 AM Jul 21,2014 09:17 AM WPF 4
loading
Tags: GridDataControl
Yu
Asked On June 30, 2014 06:55 AM

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

Saravanan M [Syncfusion]
Replied On July 4, 2014 06:45 AM

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
Replied On July 6, 2014 05:12 PM

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
Replied On July 8, 2014 03:12 PM

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

Ashok N [Syncfusion]
Replied On July 21, 2014 09:17 AM

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


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.

;