23.03.2011 17:25, patspiper wrote:
How can a control's cursor be set from a resource file?
The code below does not work, although the resource itself is found
and loaded.
Panel1.cursor := LoadCursor(0, 'CURSOR_NAME');
The same way as in delphi:
const
MyUserCursor = 1;
Screen.Cursors[MyUserCursor] := LoadCursor(HInstance, 'Cursor_Name');
Panel1.Cursor := MyUserCursor;
LoadCursor works on windows only.
To write cross platform code use:
var
Cur: TCursorImage;
begin
Cur := TCursorImage.Create;
Cur.LoadFromResourceName('Cursor_Name');
Screen.Cursors[MyUserCursor] := Cur.ReleaseHandle;
Cur.Free;
Panel1.Cursor := MyUserCursor;
end;
Best regards,
Paul Ishenin
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus