/// <summary> /// Returns an image from the Player.Copy.Mode part of the screen with the specified dimensions. See also: Player.Video.ToImage. /// </summary> /// <param name="size">The size of the longest side of the image while maintaining the aspect ratio.</param> public Image ToImage(int size) { Image theImage = null; if (size >= 8) { Image copy = ToImage(); if (copy != null) { try { //if (copy.Width > copy.Height) theImage = new Bitmap(copy, size, (size * copy.Height) / copy.Width); //else theImage = new Bitmap(copy, (size * copy.Width) / copy.Height, size); if (copy.Width > copy.Height) { theImage = _base.AV_ResizeImage(copy, size, (size * copy.Height) / copy.Width); } else { theImage = _base.AV_ResizeImage(copy, (size * copy.Width) / copy.Height, size); } } catch (Exception e) { _base._lastError = (HResult)Marshal.GetHRForException(e); } copy.Dispose(); } } else { _base._lastError = HResult.MF_E_OUT_OF_RANGE; } return(theImage); }