Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-10

Transparent cursor

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

LacaK

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.

Reply by email