1.用API函数ClipCursor就可以了。传一个Rect类型的变量给他。Rect类型需要声明如:
dim R as Rect
R.left=100
R.right=200
R.Top=100
R.Button=200
ClipCursor(R)
dim R as Rect
R.left=100
R.right=200
R.Top=100
R.Button=200
ClipCursor(R)
解决方案 »
- delphi按键问题.....等待解决
- 欢迎大家下载使用GCI32(General Communication Interface的缩写)
- 怎样选择几条记录用fastreport进行套打?
- 问一个经典的问题,如何在保存前 判断AdoDataSet里面的非空字段
- 关于多表外连接的问题
- 怎样在DBGRID在绑定数据库时有一列是显示自己另外递加的数用来表示序列,不在数据库里的?
- 用formula one6.0实现很复杂的报表,大家看看,只要有帮助就人人给分100!决不食言!
- 数据同步的问题,有三层数据库开发经验的老手,欢迎加入。
- 散分了,没有都有
- 怎么做控件呀? 有没有可以下载的书?
- 紧急求助,MediaPlay组件如何控制左右声道?
- 请教。。。。。。
如:
var
R : TRect;
pt : TPoint; //鼠标当前点
begin
R.Left := 100;
R.Top := 100;
R.Right := 200;
R.Bottom := 200;
if ptInRect(R, pt) then
showCursor(False)
else showCursor(True);
end;
[email protected]
Michaelyfj 说的不对不过,别忘了分一点分给我.我还可以提供源代码.
[email protected]
var
r:trect;
begin
r.left:=100;
...
r.bottom:=100;
mapwindowpoints(hand,0,r,2); //将坐标转为屏幕坐标
clipcursor(@r);
end;
The GetSysColor function retrieves the current color of the specified display element. Display elements are the parts of a window and the Windows display that appear on the system display screen. DWORD GetSysColor( int nIndex // display element
);
ParametersnIndexSpecifies the display element whose color is to be retrieved. This parameter must be one of the following values: Value Meaning
COLOR_3DDKSHADOW Dark shadow for three-dimensional display elements.
COLOR_3DFACE,
COLOR_BTNFACE Face color for three-dimensional display elements.
COLOR_3DHILIGHT, COLOR_3DHIGHLIGHT, COLOR_BTNHILIGHT, COLOR_BTNHIGHLIGHT Highlight color for three-dimensional display elements (for edges facing the light source.)
COLOR_3DLIGHT Light color for three-dimensional display elements (for edges facing the light source.)
COLOR_3DSHADOW, COLOR_BTNSHADOW Shadow color for three-dimensional display elements (for edges facing away from the light source).
COLOR_ACTIVEBORDER Active window border.
COLOR_ACTIVECAPTION Active window caption.
COLOR_APPWORKSPACE Background color of multiple document interface (MDI) applications.
COLOR_BACKGROUND, COLOR_DESKTOP Desktop.
COLOR_BTNTEXT Text on push buttons.
COLOR_CAPTIONTEXT Text in caption, size box, and scroll bar arrow box.
COLOR_GRAYTEXT Grayed (disabled) text. This color is set to 0 if the current display driver does not support a solid gray color.
COLOR_HIGHLIGHT Item(s) selected in a control.
COLOR_HIGHLIGHTTEXT Text of item(s) selected in a control.
COLOR_INACTIVEBORDER Inactive window border.
COLOR_INACTIVECAPTION Inactive window caption.
COLOR_INACTIVECAPTIONTEXT Color of text in an inactive caption.
COLOR_INFOBK Background color for tooltip controls.
COLOR_INFOTEXT Text color for tooltip controls.
COLOR_MENU Menu background.
COLOR_MENUTEXT Text in menus.
COLOR_SCROLLBAR Scroll bar gray area.
COLOR_WINDOW Window background.
COLOR_WINDOWFRAME Window frame.
COLOR_WINDOWTEXT Text in windows.
Return ValuesIf the function succeeds, the return value is the red, green, blue (RGB) color value that specifies the color of the given element. ResSystem colors for monochrome displays are usually interpreted as shades of gray.
var
myrect:TRect;
begin
myrect:=button1.boundsRect;(好像是)
mapwindowpoints(hand,myrect,2);
clipcursor(@myrect);
end;
begin
MapWindowPoints(handle, 0, rt, 2); // 座标换算
ClipCursor(@rt); // 限制鼠标移动区域
end;
祝你好运
rtButton: TRect;
begin
try
rtButton := panel1.BoundsRect;
MapWindowPoints(handle, 0, rtButton, 2);
ClipCursor(@rtButton);
......
finally
rtbutton := Rect(0, 0, Screen.Width, Screen.Height);
ClipCursor(@rtbutton);
end;