这是一个RECT结构,也就是你要限制鼠标的矩形范围
Private Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type
申明一个RECT结构的变量,赋值后传入。
dim rc as RECT
with rc
    .left=....
....
end with
clipcursor rc

解决方案 »

  1.   

    看一看我的程序:
    Dim ClientDc As RECT
    ClientDc.Top = Command1.Top
    ClientDc.Left = Command1.Left
    ClientDc.Right = Command1.Left + Command1.Width
    ClientDc.Bottom = Command1.Top + Command1.Height
    SetCapture Command1.hwnd     ''这里我要填入什么参数
    ClipCursor ClientDc我想把我的鼠标限制在command1中,运行,鼠标什么限制都没有。我要怎样改写我的代码。
      

  2.   

    RECT结构中的分量是以像素为单位的,而且ClipCursor中使用的是屏幕坐标。
      

  3.   

    为什么用SetCapture呢?
    试试
    ClientDc.Top = (me.top+Command1.Top)/15
    ClientDc.Left = (me.left+Command1.Left)/15
    ClientDc.Right = (Command1.Left + Command1.Width)/15
    ClientDc.Bottom = (Command1.Top + Command1.Height)/15