110,500
社区成员
发帖
与我相关
我的任务
分享
[SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)]
public BitmapData LockBits(Rectangle rect, ImageLockMode flags, PixelFormat format, BitmapData bitmapData)
{
GPRECT gprect = new GPRECT(rect);
int status = SafeNativeMethods.Gdip.GdipBitmapLockBits(new HandleRef(this, base.nativeImage), ref gprect, flags, format, bitmapData);
if (status != 0)
{
throw SafeNativeMethods.Gdip.StatusException(status);
}
return bitmapData;
}
public Bitmap(int width, int height, int stride, PixelFormat format, IntPtr scan0)
{
IntSecurity.ObjectFromWin32Handle.Demand();
IntPtr zero = IntPtr.Zero;
int status = SafeNativeMethods.Gd[code=csharp]
ip.GdipCreateBitmapFromScan0(width, height, stride, (int) format, new HandleRef(null, scan0), out zero);
if (status != 0)
{
throw SafeNativeMethods.Gdip.StatusException(status);
}
base.SetNativeImage(zero);
}
[/code]