教程中国
PHOTOSHOP CS9.0中文版 MAYA 8.5 FOR WINDOWS Corel Painter v9.0 Flash MX2004 中文版 Illustrator cs2 中文版
VC++6.0含sp6 中英文版 VB6.0 +sp6 简体中文版 Borland Delphi 7汉化版 MSDN for vb6.0中文版 Visual Studio 2005简体
教程中国下属 文件存储共享专家BIBIDU.COM 提供大型软件,教材,源码,电影,音乐,图书等下载 更多精品请点此进入
  您目前所在位置: 教程中国 >> 编程基地 >> VB >> 停止鼠标活动 RSS订阅
停止鼠标活动
教程(视频,书籍)下载:  ASP.NET AutoCAD 数据库 C# ASP java photoshop 网页设计 delphi 3dmax Flash C++ VB 张孝祥 实例   更多请进入BIBIDU搜索
IT搜索引擎   
Snap the Mouse

Snapping the mouse to a certain position on the screen is a great little trick.

It can help suggest a command button to the user or simply make your program easier to use. And this groovy code snippet shows you how to do just that...

To use, simply call the SnapMouse method, passing the hWnd of the object you want to centre the mouse over. You抣l find that most objects come with a .hWnd property.

Usage

SnapMouse (Command2.hWnd)Code

Private Declare Function SetCursorPos Lib "user32" _
    (ByVal X As Long, ByVal Y As Long) As Long

Private Declare Function GetWindowRect Lib "user32" _
    (ByVal hWnd As Long, lpRect As RECT) As Long

Private Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type

Public Sub SnapMouse(ByVal hWnd As Long)
    
    Dim lpRect As RECT
    
    GetWindowRect hWnd, lpRect

    SetCursorPos lpRect.Left + (lpRect.Right - lpRect.Left) \ 2, _
        lpRect.Top + (lpRect.Bottom - lpRect.Top) \ 2

End Sub

来源:upschool.cn
作者:
关键字:停止鼠标活动
发表日期:2006-12-20 18:06:59

网页显示有限 阅读全文请下载本文完整版WORD文档

上一篇:如何隐藏鼠标指针   下一篇:使用动画鼠标


2008-11-20 7:21:43
本文的相类似文章
在学习中进步 在进步中成长 教程中国相随您的成长之路
华腾联合科技股份有限公司版权所有
广告联系:Rosibo@163.com