S
S
sim-dev2018-03-05 21:47:32
Delphi
sim-dev, 2018-03-05 21:47:32

How to draw on cursor in RunTime?

The problem is the following: I created a resource with a colored cursor (32 bit), built the project - everything is fine, the cursor is loaded and displayed.
Now I want to modify its appearance before "turning on" this cursor.
I load a resource and try to draw on its Canvas. However, any of my "drawings" make the original image transparent, no matter what I do.
An example of how I do.

Cur := TCursorImage.Create;
  Cur.LoadFromResourceID(HINSTANCE, CurId);
  with Cur.Canvas do begin
    Brush.Style := bsSolid;
    Brush.Color := clBlue;
    FillRect(10,10,21,21);
  end;
  Screen.Cursors[CurId] := Cur.ReleaseHandle;
  Cur.Free;

Here's the cursor you get.
5a9d90722dec8153990430.png
The red circle is the background over which the "fill" cursor moves.
I am writing in FPC, but this is not important: I need advice on how to do this at all?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Ananiev, 2018-03-05
@SaNNy32

Usually, several different cursors are made in the editor, and then the desired one is loaded during program execution.

M
Mercury13, 2018-03-05
@Mercury13

Try . There is a high probability that the mechanisms for working with 32-bit images are rather weak here. Brush.Color := $FF000000 or clBlue;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question