[Lazarus] Transparent cursor

LacaK lacak at zoznam.sk
Wed Oct 21 11:43:26 CEST 2015


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
-Laco.




More information about the Lazarus mailing list