Example #1
0
        public void PlaceBitmap(int bmpX)
        {
            if (g == null)
            {
                return;
            }
            hDC = new HandleRef(g, g.GetHdc());
            var bd = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);

            GdiProxy.SetDIBitsToDevice(hDC, r.X, r.Y, (uint)r.Width, (uint)r.Height, bmpX, 0, 0, (uint)b.Height, bd.Scan0, ref _BI, 0);
            b.UnlockBits(bd);
            g.ReleaseHdc();
        }
Example #2
0
 public void Dispose()
 {
     if (hd.Handle == IntPtr.Zero || gd == null)
     {
         return;
     }
     GdiProxy.SelectObject(hs, hOldObj);
     GdiProxy.DeleteObject(hb);
     //gd.ReleaseHdc();
     gs.ReleaseHdc();
     gs.Dispose();
     gd = gs = null;
     b  = null;
 }
Example #3
0
 public void Assign(Graphics gfx, Rectangle rect, Bitmap bmp)
 {
     Dispose();
     gd = gfx;
     b  = bmp;
     r  = rect;
     gs = Graphics.FromImage(bmp);
     hs = new HandleRef(gs, gs.GetHdc());
     //hd = new HandleRef(gd, gd.GetHdc());
     hb      = new HandleRef(bmp, bmp.GetHbitmap());
     hOldObj = new HandleRef(gs, GdiProxy.SelectObject(hs, hb));
     if (hOldObj.Handle == IntPtr.Zero)
     {
         throw new Win32Exception();
     }
 }
Example #4
0
 public void PlaceBitmap(int bmpX)
 {
     hd = new HandleRef(gd, gd.GetHdc());
     GdiProxy.BitBlt(hd, r.X, r.Y, r.Width, r.Height, hs, bmpX, 0, GdiProxy.TernaryRasterOperations.SRCCOPY);
     gd.ReleaseHdc();
 }