コード例 #1
0
 private static SCapture.IconInfo GetIconInfo(IntPtr hicon)
 {
     SCapture.IconInfo result = default(SCapture.IconInfo);
     if (!SCapture.UnsafeNativeMethods.GetIconInfo(hicon, ref result))
     {
         int lastWin32Error = Marshal.GetLastWin32Error();
         throw new SCaptureException(new Win32Exception(lastWin32Error).Message);
     }
     return(result);
 }
コード例 #2
0
 private static void DrawCursor(Rectangle rect, Bitmap bmp)
 {
     SCapture.CursorInfo cursorInfo = SCapture.GetCursorInfo();
     checked
     {
         if (cursorInfo.flags == 1u && rect.Contains(cursorInfo.ptScreenPos))
         {
             IntPtr            cursorIcon = SCapture.GetCursorIcon(cursorInfo.hCursor);
             SCapture.IconInfo iconInfo   = SCapture.GetIconInfo(cursorIcon);
             Graphics          graphics   = Graphics.FromImage(bmp);
             graphics.DrawIcon(Icon.FromHandle(cursorIcon), (int)(unchecked ((long)(checked (cursorInfo.ptScreenPos.X - rect.X))) - (long)(unchecked ((ulong)iconInfo.xHotspot))), (int)(unchecked ((long)(checked (cursorInfo.ptScreenPos.Y - rect.Y))) - (long)(unchecked ((ulong)iconInfo.yHotspot))));
             graphics.Dispose();
         }
     }
 }
コード例 #3
0
 public static extern bool GetIconInfo(IntPtr hIcon, ref SCapture.IconInfo piconinfo);