Lazarus

Programming => Graphics and Multimedia => Graphics => Topic started by: LacaK on October 22, 2015, 07:20:09 am

Title: Transparent cursor
Post by: LacaK on October 22, 2015, 07:20:09 am
Hi,
I am trying create custom cursor with transparent background.
I want cursor, which looks like frame with inside contents transparent.

Look at this code fragment:

var
  B: TBitmap;
  C: TCursorImage;
begin
  B := TBitmap.Create;
  B.SetSize(23,15);
  B.TransparentColor:=clWhite;
  B.Transparent:=True;
  B.Canvas.Brush.Color:=clWhite; //transparent background ?
  B.Canvas.Pen.Style:=psDot;
  B.Canvas.Rectangle(0,0,23,15);
  C := TCursorImage.Create;
  C.Assign(B);
  C.HotSpot:=Point(0,0);
  //C.Mask(clWhite);
  //C.Masked:=True;
  Screen.Cursors[4] := C.ReleaseHandle;
  C.Free;
  B.Free;
end;

This works, but whole rectangle is shown as cursor. When cursor moves over objects they are under cursor rectangle.
What I do wrong ?

Thanks
(Same question was posted to Lazarus mailinglist)
TinyPortal © 2005-2018