如何自定义自己的光标图标啊,比如我想当鼠标移到Panel上时,鼠标光标图标变成放大镜的样式,而不是一个箭头

解决方案 »

  1.   

    如果是系统自带的图标,直接设置控件的cursor属性就可以
    如果是你的光标,先放到system32下面,然后参考这个:
    This example shows how to add custom cursors to an application.  It assumes that a custom cursor with the name NewCursor has been added to the resources (.RES file) of the application. You can add the cursor using the image editor. (Tools | Image Editor)
    The following code makes this cursor available to the application via the constant crMyCursor, and sets it as the global cursor to the application.const  crMyCursor = 5;
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      Screen.Cursors[crMyCursor] := LoadCursor(HInstance, 'NewCursor');
      Cursor := crMyCursor;
    end;
      

  2.   

    就改一下这个panel的Cursors就行了
      

  3.   

    好像image editor不支持彩色图标啊
      

  4.   

    1、Panel.Cursor:=crSQLWait;
    2、采取hellolongbin(一个人)的方法
      

  5.   

    采用hellolongbin(一个人) 的方法,前提也有:就是利用Delphi自带的Image Editor程序建立自己的鼠标图案(.res)文件,且把文件保存在程序的同一目录下
    procedure TForm1.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
    begin
      Screen.Cursors[crMyCursor] := LoadCursor(HInstance, 'NewCursor');   //NewCursor是.res文件中鼠标的名称
      Cursor := crMyCursor;
    end;