コード例 #1
0
        internal IntPtr CreateHalftoneHBRUSH()
        {
            short[] array = new short[8];
            for (int i = 0; i < 8; i++)
            {
                array[i] = (short)(21845 << (i & 1));
            }
            IntPtr intPtr = SafeNativeMethods.CreateBitmap(8, 8, 1, 1, array);

            NativeMethods.LOGBRUSH lOGBRUSH = new NativeMethods.LOGBRUSH();
            lOGBRUSH.lbColor = ColorTranslator.ToWin32(Color.Black);
            lOGBRUSH.lbStyle = 3;
            lOGBRUSH.lbHatch = intPtr;
            IntPtr result = SafeNativeMethods.CreateBrushIndirect(lOGBRUSH);

            SafeNativeMethods.DeleteObject(new HandleRef(null, intPtr));
            return(result);
        }