_CreateDIBSection() private method

private _CreateDIBSection ( SafeDC hdc, [ bitmapInfo, int iUsage, [ ppvBits, IntPtr hSection, int dwOffset ) : SafeHBITMAP
hdc SafeDC
bitmapInfo [
iUsage int
ppvBits [
hSection System.IntPtr
dwOffset int
return SafeHBITMAP
Example #1
0
        public static SafeHBITMAP CreateDIBSection(SafeDC hdc, ref BITMAPINFO bitmapInfo, out IntPtr ppvBits, IntPtr hSection, int dwOffset)
        {
            SafeHBITMAP safeHBITMAP;

            if (hdc == null)
            {
                safeHBITMAP = NativeMethods._CreateDIBSectionIntPtr(IntPtr.Zero, ref bitmapInfo, 0, out ppvBits, hSection, dwOffset);
            }
            else
            {
                safeHBITMAP = NativeMethods._CreateDIBSection(hdc, ref bitmapInfo, 0, out ppvBits, hSection, dwOffset);
            }
            if (safeHBITMAP.IsInvalid)
            {
                HRESULT.ThrowLastError();
            }
            return(safeHBITMAP);
        }