Пример #1
0
        public void DrawCursor(IntPtr hdcDest, Point offset)
        {
            if (IsVisible)
            {
                Point drawPosition = new Point(Position.X - offset.X, Position.Y - offset.Y);
                drawPosition = CaptureHelpers.ScreenToClient(drawPosition);

                NativeMethods.DrawIconEx(hdcDest, drawPosition.X, drawPosition.Y, Handle, 0, 0, 0, IntPtr.Zero, NativeConstants.DI_NORMAL);
            }
        }
Пример #2
0
        public void DrawCursor(Image img, Point offset)
        {
            if (IsVisible)
            {
                Point drawPosition = new Point(Position.X - offset.X, Position.Y - offset.Y);
                drawPosition = CaptureHelpers.ScreenToClient(drawPosition);

                using (Graphics g = Graphics.FromImage(img))
                    using (Icon icon = Icon.FromHandle(Handle))
                    {
                        g.DrawIcon(icon, drawPosition.X, drawPosition.Y);
                    }
            }
        }