Esempio n. 1
0
        // Token: 0x06000059 RID: 89 RVA: 0x00007018 File Offset: 0x00005218
        public void SetBits(Bitmap bitmap)
        {
            bool flag  = Image.IsCanonicalPixelFormat(bitmap.PixelFormat) && Image.IsAlphaPixelFormat(bitmap.PixelFormat);
            bool flag2 = flag;
            bool flag3 = flag2;
            bool flag4 = flag3;
            bool flag5 = flag4;
            bool flag6 = flag5;
            bool flag7 = flag6;
            bool flag8 = flag7;
            bool flag9 = flag8;

            if (flag9)
            {
                IntPtr hObj    = IntPtr.Zero;
                IntPtr dc      = HelpWin32.GetDC(IntPtr.Zero);
                IntPtr intPtr  = IntPtr.Zero;
                IntPtr intPtr2 = HelpWin32.CreateCompatibleDC(dc);
                try
                {
                    HelpWin32.Point         point         = new HelpWin32.Point(base.Left, base.Top);
                    HelpWin32.Size          size          = new HelpWin32.Size(bitmap.Width, bitmap.Height);
                    HelpWin32.BLENDFUNCTION blendfunction = default(HelpWin32.BLENDFUNCTION);
                    HelpWin32.Point         point2        = new HelpWin32.Point(0, 0);
                    intPtr = bitmap.GetHbitmap(Color.FromArgb(0));
                    hObj   = HelpWin32.SelectObject(intPtr2, intPtr);
                    blendfunction.BlendOp             = 0;
                    blendfunction.SourceConstantAlpha = byte.MaxValue;
                    blendfunction.AlphaFormat         = 1;
                    blendfunction.BlendFlags          = 0;
                    HelpWin32.UpdateLayeredWindow(base.Handle, dc, ref point, ref size, intPtr2, ref point2, 0, ref blendfunction, 2);
                    return;
                }
                finally
                {
                    bool flag10 = intPtr != IntPtr.Zero;
                    bool flag11 = flag10;
                    bool flag12 = flag11;
                    bool flag13 = flag12;
                    bool flag14 = flag13;
                    bool flag15 = flag14;
                    bool flag16 = flag15;
                    bool flag17 = flag16;
                    bool flag18 = flag17;
                    if (flag18)
                    {
                        HelpWin32.SelectObject(intPtr2, hObj);
                        HelpWin32.DeleteObject(intPtr);
                    }
                    HelpWin32.ReleaseDC(IntPtr.Zero, dc);
                    HelpWin32.DeleteDC(intPtr2);
                }
            }
            throw new ApplicationException("图片必须是32位带Alhpa通道的图片。");
        }
Esempio n. 2
0
 public static extern int UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst, ref HelpWin32.Point pptDst, ref HelpWin32.Size psize, IntPtr hdcSrc, ref HelpWin32.Point pptSrc, int crKey, ref HelpWin32.BLENDFUNCTION pblend, int dwFlags);