카테고리 없음

[일반/컴포넌트] 커서(Cursor)의 이미지 구하기

쇼핑스크래퍼2 2023. 9. 4. 08:07
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation
{$R *.dfm}

procedure DrawCursor (ACanvas:TCanvas;
                      Position:TPoint);
var
  HCursor : THandle;
begin
  HCursor := Screen.Cursors[Ord(crHandPoint)]; // 그리고 싶은 커서(crHandPoint)
  DrawIconEx(ACanvas.Handle, Position.X, Position.Y,
             HCursor, 32, 32, 0, 0, DI_NORMAL);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  i: Integer;
begin
  for i := 1 to 10 do
    DrawCursor(form1.Canvas, Point(50,i*20));
end;

end.