如何在DBGrid中使用鼠标滚轮,来垂直滚动和水平滚动,或者有人开发过这方面的控件,:)提出问题,解决问题,提高水平。

解决方案 »

  1.   

    http://expert.csdn.net/Expert/topic/1236/1236355.xml
      

  2.   

    没有,不过这有一篇关于智能的文章:对智能鼠标的响应:
    #if(_WIN32_WINNT >= 0x0400) 
    #define WM_MOUSEWHEEL                   0x020A 
    #endif 
    #if (_WIN32_WINNT < 0x0400) 
    #define WM_MOUSELAST                    0x0209 
    #else 
    #define WM_MOUSELAST                    0x020A 
    #endif 
     
    #if(_WIN32_WINNT >= 0x0400) 
    #define WHEEL_DELTA                     120     /* Value for rolling one detent */ 
    #endif
    #if(_WIN32_WINNT >= 0x0400) 
    #define WHEEL_PAGESCROLL                (UINT_MAX) /* Scroll one page */ 
    #endif
     
    #define WM_PARENTNOTIFY                 0x0210 
    #define MENULOOP_WINDOW                 0 
    #define MENULOOP_POPUP                  1 
    #define WM_ENTERMENULOOP                0x0211 #define MOUSEEVENTF_WHEEL       0x0800 /* wheel button rolled */ 
    procedure tmditted.applicationonmessage(var Msg: TMsg; var Handled: Boolean);
    begin 
      if (msg.message = 52294) and (MDIchildcount > 0) then //Kollar rullknappen pO en microsoft intellimouse
        case msg.wparam of
          -120 : activemdichild.activecontrol.perform (em_linescroll,0,-1);
           120 : activemdichild.activecontrol.perform (em_linescroll,0,1);
        end;
    end;(*
    WM_MOUSEWHEELThe WM_MOUSEWHEEL message is sent to the focus window when the mouse wheel is
    rotated. The DefWindowProc function propagates the message to the windows parent.
    There should be no internal forwarding of the message, since DefWindowProc
    propagates it up the parent chain until it finds a window that processes it.WM_MOUSEWHEEL
    fwKeys = LOWORD(wParam);    // key flags
    zDelta = (short) HIWORD(wParam);    // wheel rotation
    xPos = (short) LOWORD(lParam);    // horizontal position of pointer
    yPos = (short) HIWORD(lParam);    // vertical position of pointerParametersfwKeys 
      Value of the low-order word of wParam. Indicates whether various virtual keys
      are down. This parameter can be any combination of the following values:      Value        Description
          MK_CONTROL   Set if the CTRL key is down.
          MK_LBUTTON   Set if the left mouse button is down.
          MK_MBUTTON   Set if the middle mouse button is down.
          MK_RBUTTON   Set if the right mouse button is down.
          MK_SHIFT     Set if the SHIFT key is down. zDelta 
         The value of the high-order word of wParam. Indicates the distance that the
         wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA, which is
         120. A positive value indicates that the wheel was rotated forward, away from
         the user; a negative value indicates that the wheel was rotated backward,
         toward the user.
    xPos 
         Value of the low-order word of lParam. Specifies the x-coordinate of the pointer,
         relative to the upper-left corner of the screen.
    yPos 
         Value of the high-order word of lParam. Specifies the y-coordinate of the pointer,
         relative to the upper-left corner of the screen. ResThe zDelta parameter will be a multiple of WHEEL_DELTA, which is set at 120. This is
    the threshold for action to be taken, and one such action (for example, scrolling one
    increment) should occur for each delta.The delta was set to 120 to allow Microsoft or other vendors to build finer-resolution
    wheels in the future, including perhaps a freely-rotating wheel with no notches. The
    expectation is that such a device would send more messages per rotation, but with a
    smaller value in each message. To support this possibility, you should either add the
    incoming delta values until WHEEL_DELTA is reached (so for a given delta-rotation you
    get the same response), or scroll partial lines in response to the more frequent
    messages. You could also choose your scroll granularity and accumulate deltas until it
    is reached.QuickInfo  Windows NT: Use version 4.0 and later. Implemented as ANSI and Unicode messages. 
      Header: Declared in winuser.h.
    *)
      

  3.   

    在DBGrid的Keydown中就可以实现啊。
    在Keydown事件里调用dBGrid的perform函数.有个滚动消息发送一下就可以了.
    具体消息忘记了,你可以搜一下!
      

  4.   

    http://expert.csdn.net/Expert/topic/1236/1236355.xml?temp=.4970667