예제 #1
0
파일: Pipette.cs 프로젝트: logtcn/greenshot
		/// <summary>
		/// Create a cursor from the supplied bitmap & hotspot coordinates
		/// </summary>
		/// <param name="bitmap">Bitmap to create an icon from</param>
		/// <param name="hotspotX">Hotspot X coordinate</param>
		/// <param name="hotspotY">Hotspot Y coordinate</param>
		/// <returns>Cursor</returns>
		private static Cursor CreateCursor(Bitmap bitmap, int hotspotX, int hotspotY) {
			using (SafeIconHandle iconHandle = new SafeIconHandle( bitmap.GetHicon())) {
				IntPtr icon;
				IconInfo iconInfo = new IconInfo();
				User32.GetIconInfo(iconHandle, out iconInfo);
				iconInfo.xHotspot = hotspotX;
				iconInfo.yHotspot = hotspotY;
				iconInfo.fIcon = false;
				icon = User32.CreateIconIndirect(ref iconInfo);
				return new Cursor(icon);
			}
		}
예제 #2
0
 public static extern bool GetIconInfo(SafeIconHandle iconHandle, out IconInfo iconInfo);
예제 #3
0
 public static extern bool GetIconInfo(SafeIconHandle iconHandle, out IconInfo iconInfo);