mardi 24 février 2015

How to Create Height-Resolution Image from a FrameworkElement?

i have a FrameworkElement and i want to save it as a Height-Resolution Image (Jpeg) a tried the following code but the results is not well, i got bad resolution image, when i print it in an A4 paper size.



// ...
FrameworkElement element = this.Content;
element.Measure(new System.Windows.Size(double.PositiveInfinity, double.PositiveInfinity));
element.Arrange(new Rect(element.DesiredSize));
element.UpdateLayout();

// i used element.ActulaHeight and ActualWidth but not works.
RenderTargetBitmap bitmap = new RenderTargetBitmap((int)element.Width, (int)element.Height, GPFReporstPageSizeExtension.DPI, GPFReporstPageSizeExtension.DPI, System.Windows.Media.PixelFormats.Pbgra32);
bitmap.Render(element);
// ....

Aucun commentaire:

Enregistrer un commentaire