1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| System.Drawing.Bitmap Bitmap = (Bitmap)System.Drawing.Image.FromStream(Stream);
WriteableBitmap WriteableBitmap = this.bitmap;
//BitmapData Data = Bitmap.LockBits(new Rectangle(0, 0, Bitmap.Width, Bitmap.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
WriteableBitmap.Lock();
System.Drawing.Bitmap Bmp = new Bitmap(1680, 1050, 1680 * 4, System.Drawing.Imaging.PixelFormat.Format32bppPArgb, WriteableBitmap.BackBuffer);
System.Drawing.Graphics BitmapGraphics = System.Drawing.Graphics.FromImage(Bmp);
BitmapGraphics.DrawImage(Bitmap, Screen.X, Screen.Y, Bitmap.Width, Bitmap.Height);
BitmapGraphics.Dispose();
Int32Rect Rect = new Int32Rect(Screen.X, Screen.Y, Bitmap.Width, Bitmap.Height);
WriteableBitmap.AddDirtyRect(Rect);
//Bitmap.UnlockBits(Data);
WriteableBitmap.Unlock();
Bitmap.Dispose(); |
Partager