您当前的位置:素材库 -> 网络编程 -> .NET编程 -> 文章内容
可拖动的无标题栏窗体
作者:郁郁小蝎  来源:中国站长学院  发布时间:2005-6-28 9:51:08  发布人:superren

注意:要设置formcontrolbox属性为false

特别注意: form.text要设置为空,否则不会把标题栏去掉

Dim MousX As Integer

Dim MousY As Integer

Dim CurrX As Integer

Dim CurrY As Integer

 

 Public Sub myMouseDown(ByVal sender As Object, ByVal ex As MouseEventArgs) Handles MyBase.MouseDown

        If ex.Button = MouseButtons.Left Then

            '如果是鼠标左键,则不捕获鼠标

            Me.Capture() = False

 

            '获得鼠标坐标(相对于窗体)

            MousX = ex.X

            MousY = ex.Y

        End If

    End Sub

 

    Public Sub myMouseMove(ByVal sender As Object, ByVal ex As MouseEventArgs) Handles MyBase.MouseMove

        If ex.Button = MouseButtons.Left Then

            '左键操作

            CurrX = Me.Left - MousX + ex.X

            CurrY = Me.Top - MousY + ex.Y

            '设置窗体相对于屏幕的坐标

            Me.SetDesktopLocation(CurrX, CurrY)

        End If

    End Sub

    '

    Public Sub myMouseUp(ByVal sender As Object, ByVal ex As MouseEventArgs) Handles MyBase.MouseUp

        If ex.Button = MouseButtons.Left Then

            Me.Capture() = True

           

        End If

    End Sub


热门文章
· [图文] 从黑人变成白..
· [图文] Photoshop教你..
· [图文] Photoshop虚化..
· [图文] 巧妙的幻灯片..
· [图文] Photoshop将肖..
· [图文] Photoshop轻松..
· [图文] Photoshop数码..
· [图文] photoshop有效..
· [图文] Photoshop为婚..
· [图文] Photoshop制作..
相关文章
· [组图] 在网页中显示..
· [组图] Dreamweaver ..
推荐广告
[ ] [返回上一页] [打 印] [收 藏]
上一篇文章:正弦函数的绘制的一种方法
下一篇文章:带颜色的listbox控件
∷相关文章评论∷    (评论内容只代表网友观点,与本站立场无关!) [更多评论...]
Copyright © 2005 - 2008 chinasck.com . All Rights Reserved 中国素材库 版权所有