我正在使用这个 TCanvas 为我的鼠标绘制光标
Canv := TCanvas.Create;
Canv.Handle := GetWindowDC(0);
.... 对于每个老鼠事件,请执行以下操作
Bitmap:=TBitmap.Create;
CursorInfo.cbSize := sizeof(CursorInfo);
GetCursorInfo(CursorInfo);
Bitmap.Width := 32;
Bitmap.Height := 32;
Bitmap.Transparent:=true;
DrawIconEx(Bitmap.Canvas.Handle, 0,0, CursorInfo.hCursor, 32,32, 0,0, DI_NORMAL) ;
Bitmap.Canvas.Brush.Color := RGB(250,250,250);
Bitmap.Canvas.FloodFill(31,0, clWhite, fsSurface);
Bitmap.Canvas.FloodFill(0,0, clWhite, fsSurface);
currentX:=getcurrentxpos;
currentY:=getcurrentypos;
Canv.Draw(currentX,currentY,Bitmap);
Bitmap.Free;
问题不只是显示单个光标,而是显示鼠标轨迹。我可以在鼠标移动时清除整个画布吗?(虽然听起来不是一个好主意)。也许我可以Canv.Draw
通过执行该代码的反向来清除我以前的代码(如果可能的话)?关于如何显示光标的任何建议?
编辑:尝试Canv.Draw(currentX,currentY,Bitmap);
在设置位图宽度和高度后插入另一个……现在的问题是我有一条白色的轨迹(而不是鼠标轨迹),干净得多,但仍然没有好处。