Mega Code Archive

 
Categories / Delphi / Examples
 

What does my cursor look like

Recently I needed to render the Screen's Cursor image to a bitmap. This is how to do it. var HCursor: THandle; begin //Get the handle of the current cursor HCursor := Screen.Cursors[Ord(Screen.Cursor)]; //Draw the icon to a canvas DrawIconEx(MyBitmap.Canvas.Handle, XPos,Ypos,HCursor,32,32,0,0,DI_NORMAL); end; See DrawIconEx in the Delphi help for combinations which may replace DI_NORMAL, like DI_MASK or DI_DEFAULTSIZE