Example #1
0
        public static void UpdateLayeredWindowHelper(Control control, Bitmap bmp)
        {
            IntPtr dC = Win32.GetDC(IntPtr.Zero);

            Win32.Point point   = new Win32.Point(control.Left, control.Top);
            Win32.Size  size    = new Win32.Size(bmp.Width, bmp.Height);
            IntPtr      intPtr  = Win32.CreateCompatibleDC(IntPtr.Zero);
            IntPtr      hbitmap = bmp.GetHbitmap(Color.Black);

            Win32.SelectObject(intPtr, hbitmap);
            Win32.Point         point2        = new Win32.Point(0, 0);
            Win32.BlendFunction blendFunction = default(Win32.BlendFunction);
            blendFunction.BlendOp             = 0;
            blendFunction.BlendFlags          = 0;
            blendFunction.SourceConstantAlpha = 255;
            blendFunction.AlphaFormat         = 1;
            Win32.UpdateLayeredWindow(control.Handle, dC, ref point, ref size, intPtr, ref point2, 0, ref blendFunction, 2);
            Win32.DeleteObject(hbitmap);
            Win32.DeleteDC(intPtr);
            Win32.ReleaseDC(IntPtr.Zero, dC);
        }
Example #2
0
 public static extern bool GetTextExtentExPoint(IntPtr hdc, string lpszStr, int cchString, int nMaxExtent, out int lpnFit, IntPtr alpDx, out Win32.Size lpSize);
Example #3
0
 public static extern bool UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst, ref Win32.Point pptDst, ref Win32.Size psize, IntPtr hdcSrc, ref Win32.Point pptSrc, int crKey, ref Win32.BlendFunction pblend, int dwFlags);
Example #4
0
 public static void UpdateLayeredWindowHelper(Control control, Bitmap bmp)
 {
     IntPtr dC = Win32.GetDC(IntPtr.Zero);
     Win32.Point point = new Win32.Point(control.Left, control.Top);
     Win32.Size size = new Win32.Size(bmp.Width, bmp.Height);
     IntPtr intPtr = Win32.CreateCompatibleDC(IntPtr.Zero);
     IntPtr hbitmap = bmp.GetHbitmap(Color.Black);
     Win32.SelectObject(intPtr, hbitmap);
     Win32.Point point2 = new Win32.Point(0, 0);
     Win32.BlendFunction blendFunction = default(Win32.BlendFunction);
     blendFunction.BlendOp = 0;
     blendFunction.BlendFlags = 0;
     blendFunction.SourceConstantAlpha = 255;
     blendFunction.AlphaFormat = 1;
     Win32.UpdateLayeredWindow(control.Handle, dC, ref point, ref size, intPtr, ref point2, 0, ref blendFunction, 2);
     Win32.DeleteObject(hbitmap);
     Win32.DeleteDC(intPtr);
     Win32.ReleaseDC(IntPtr.Zero, dC);
 }