private void UpdateImage() { if (bmp.Handle != IntPtr.Zero) //以下代码将原始图像数据用来进行图像! { Win32Api.CopyMemory((IntPtr)bmp.Pointer, (IntPtr)DataCopy, bmp.Stride * bmp.Height); } switch (filters) { case FiltersMethod.BoxBlur: BlurEffect.BoxBlur(bmp, (int)trbValue.Value); break; case FiltersMethod.Mosaic: BlurEffect.Mosaic(bmp, (int)trbValue.Value); break; } Graphics G = picPreview.CreateGraphics(); IntPtr Hdc = G.GetHdc(); bmp.DrawImage(Hdc, DestX, DestY, ViewWidth, ViewHeight, 0, 0, bmp.Width, bmp.Height); G.ReleaseHdc(); G.Dispose(); picPreview.Invalidate(); Graphics Gcanvas = canvas.CreateGraphics(); IntPtr canvasHdc = Gcanvas.GetHdc(); bmp.DrawImage(canvasHdc, 0, 0, canvas.Width, canvas.Height, 0, 0, bmp.Width, bmp.Height); Gcanvas.ReleaseHdc(); Gcanvas.Dispose(); canvas.Invalidate(); }