|
|
| 首页 | 技术文章 | 软件下载 | 博客 | 论坛 | 精品教程 | 黑客动画 | 视频资源 | 在线服务 | 黑客游戏 | | ||||
|
|
||||||||
|
||||||||
|
|||||
| VB.NET 拖动无边框窗体编程实例 | |||||
作者:不详 文章来源:CnXHacker.Net 点击数: 更新时间:2007-7-27 ![]() |
|||||
|
Imports System.Windows.Forms '****************************************** Private oOriginalRegion As Region = Nothing ' 用于窗体移动 Private bFormDragging As Boolean = False Private oPointClicked As Point '****************************************** Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown Me.bFormDragging = True Me.oPointClicked = New Point(e.X, e.Y) End Sub '****************************************** Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp Me.bFormDragging = False End Sub '****************************************** Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove If Me.bFormDragging Then Dim oMoveToPoint As Point ' 以当前鼠标位置为基础,找出目标位置 oMoveToPoint = Me.PointToScreen(New Point(e.X, e.Y)) ' 根据开始位置作出调整 oMoveToPoint.Offset(Me.oPointClicked.X * -1, _ (Me.oPointClicked.Y + _ SystemInformation.CaptionHeight + _ SystemInformation.BorderSize.Height) * -1) ' 移动窗体 Me.Location = oMoveToPoint End If End Sub |
|||||
| 文章录入:IceRiver 责任编辑:IceRiver | |||||
| 【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 | |||||
网友评论:(只显示最新5条。评论内容只代表网友观点,与本站立场无关!) |
| 关于我们 - 版权声明 - 帮助(?) - 广告服务 - 联系我们 - 友情链接 - 用户注册 - | Powered by ICE RIVER - STUDIO |
| » CnXHacker.CoM | © CopyRight 2002-2006, CnXHacker.CoM™, Inc. All Rights Reserved. |