Thema: Delphi Cursor aus Bitmap laden

Einzelnen Beitrag anzeigen

FrEEzE2046

Registriert seit: 25. Aug 2009
27 Beiträge
 
#1

Cursor aus Bitmap laden

  Alt 2. Sep 2009, 07:37
Hallo,

ich habe eine Bitmap-Datei, die ich bei einem Drag&Drop Vorgang als Cursor verwenden möchte. Das mache ich im Moment so:

Delphi-Quellcode:
procedure TfrmMain.CreateCursor();
var
  bmpMask, bmpColor : TBitmap;
  iiIconInfo : TIconInfo;
begin
  bmpMask := TBitmap.Create();
  bmpColor := TBitmap.Create();

  try
    bmpMask.LoadFromFile( ExtractFilePath(ParamStr(0)) + '\cursor\list_drag_small.bmp' );
    bmpColor.LoadFromFile( ExtractFilePath(ParamStr(0)) + '\cursor\list_drag_small.bmp' );

    with iiIconInfo do
    begin
      fIcon := false;
      xHotspot := 15;
      yHotspot := 15;
      hbmMask := bmpMask.Handle;
      hbmColor := bmpColor.Handle;
    end; (* of with *)

    Screen.Cursors[crLVDrag] := CreateIconIndirect(iiIconInfo);
  finally
    bmpMask.Free();
    bmpColor.Free();
  end; (* of finally *)
end; (* of CreateCursor *)
(* -------------------------------------------------------------------------- *)

Das Problem dabei ist, dass rund um meinen Cursor ein viereckiger schwarzer Hintergrund ist.
  Mit Zitat antworten Zitat