Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. ScreenCapture = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(bmp.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(width, height));
  2.  
  3. public static BitmapSource ToBitmapSource(this System.Drawing.Image source)
  4. {
  5. System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(source);
  6.  
  7. var bitSrc = bitmap.ToBitmapSource();
  8.  
  9. bitmap.Dispose();
  10. bitmap = null;
  11.  
  12. return bitSrc;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement