1.用API函数ClipCursor就可以了。传一个Rect类型的变量给他。Rect类型需要声明如:
dim R as Rect
R.left=100
R.right=200
R.Top=100
R.Button=200
ClipCursor(R)

解决方案 »

  1.   

    用API函数ShowCursor(boolean)
    如:
    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;
      

  2.   

    有一个鼠标api可以实现,具体名字忘了,你来信吧.
    [email protected]
      

  3.   

    Nicrosoft 说的很对
    Michaelyfj 说的不对不过,别忘了分一点分给我.我还可以提供源代码.
    [email protected]
      

  4.   


    var 
    r:trect;
    begin
     r.left:=100;
      ...
     r.bottom:=100;
    mapwindowpoints(hand,0,r,2);  //将坐标转为屏幕坐标
    clipcursor(@r);
    end;
      

  5.   

    //颜色存贮用下面的apiform1.color:=GetSysColor(索引值); 
    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. 
      

  6.   

    举一个例子,将鼠标锁定在button1中.
    var
        myrect:TRect;
    begin
        myrect:=button1.boundsRect;(好像是)
        mapwindowpoints(hand,myrect,2);  
        clipcursor(@myrect);
    end;
      

  7.   

    procedure lmt(rt:trect);
    begin
        MapWindowPoints(handle, 0, rt, 2); // 座标换算
        ClipCursor(@rt); // 限制鼠标移动区域
    end;
      

  8.   

    使用api函数clipcursor可以将鼠标锁定在一定区域里,具体请查win32 SDK吧,对于问题2,你必须将comboBox定义为自绘画控件(在属性里有),然后在每一次的自绘画消息里画你想要的颜色到comboBox里,具体用法参见这个社区里的技术文章<C++ Builder 中的自画功能>吧!
    祝你好运
      

  9.   

    var
        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;