程序的魔法

  :: 首页 :: 博问 :: 闪存 :: :: 联系 :: :: 管理 ::

控制鼠标的形状

   我们在做数据库应用的时候,经常会使用到SQL查询,或者一些很费时间的操作,当然其它运算也会出现这种状况,在运算执行的过程中,我们希望能够鼠标形状变为忙状态,这样比较直观。
其实在Delphi里面实现这个效果是非常简单的。只要使用下面一个简单的语句就可以实现。
Try
  screen.Cursor :
=crHourGlass;  
//你的运算
 
finally
     screen.Cursor :
= crDefault;
end;
 
 
代码就是这么简单的一点,关键是我们要知道通过鼠标显示状态对应的值,它是用一个枚举类型的变量存储的,我们可以通过Delphi的帮助系统查找到。
Unit
 
Controls or QControls
 
Delphi syntax:
 
type TCursor = -32768..32767;
 
C++ syntax:
 
enum TCursor {crMin=0x7fff-1, crMax=0x7fff};
 
Description
 
TCursor is an index into the global list of available cursors maintained by the Screen variable. TCursor values can include indexes to custom cursors added by an application, in addition to the predefined constants defined in the controls unit. The following table lists the predefined cursor constants and their position in the Cursors property array:
不同的值对应的不同鼠标如下所示:
 

有了这些,我们就可以根据自己的需要改变鼠标形状了。
posted on 2005-05-21 18:33  BlueMagic  阅读(916)  评论(1编辑  收藏  举报