private Bitmap GetComposedScreenshotThumbnail()
        {
            Trace.WriteLine("Creating thumbnail...", string.Format("ComposedScreenshot.GetComposedScreenshotThumbnail [{0}]", System.Threading.Thread.CurrentThread.Name));

            float ImageAspectRatio = (float)ComposedScreenshotImage.Width / (float)ComposedScreenshotImage.Height;

            float TargetWidth  = Math.Min(Screen.PrimaryScreen.WorkingArea.Width / 4, ComposedScreenshotImage.Width);
            float TargetHeight = TargetWidth / ImageAspectRatio;

            if (TargetHeight >= Screen.PrimaryScreen.WorkingArea.Height - 20)
            {
                //resulting scaled image would be too tall
            }

            Bitmap result = ComposedScreenshotImage.GetThumbnailImage((int)TargetWidth, (int)TargetHeight, null, IntPtr.Zero) as Bitmap;

            Trace.WriteLine("Done.", string.Format("ComposedScreenshot.GetComposedScreenshotThumbnail [{0}]", System.Threading.Thread.CurrentThread.Name));
            return(result);
        }
Ejemplo n.º 2
0
 internal MemoryStream EditedScreenshotPNGImageStream()
 {
     return(ComposedScreenshotImage.ToMemoryStream(ImageFormat.Png));
 }