Ejemplo n.º 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);
        }
Ejemplo n.º 2
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);
 }
Ejemplo n.º 3
0
 public static extern void GetCaretPos(out Win32.Point pt);
Ejemplo n.º 4
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);
Ejemplo n.º 5
0
 public static extern int MapWindowPoints(IntPtr hWndFrom, IntPtr hWndTo, ref Win32.Point pt, int cPoints);