.net (vb) wpf 模仿QQ 吸附窗体

.net (vb) wpf 模仿QQ 吸附窗体,第1张

概述Imports System.WindowsImports System.Windows.FormsImports System.DrawingClass MainWindow ''' ''' 拖动窗体 ''' ''' ''' Protected Overrides Sub OnMouse
  
imports System.windowsimports System.windows.Formsimports System.DrawingClass MainWindow        '''        ''' 拖动窗体        '''        '''         '''         Protected OverrIDes Sub OnMouseleftbuttonDown(ByVal e As MousebuttonEventArgs)                MyBase.OnMouseleftbuttonDown(e)                Me.DragMove()        End Sub        Private hh As Boolean = False        Private tt As Boolean = False        Private timer As New Timer        Private Sub MainWindow_Loaded(sender As Object,e As System.windows.RoutedEventArgs) Handles Me.Loaded                timer.Enabled = True                AddHandler timer.Tick,AddressOf timertick        End Sub        Private Sub timertick()                If hh = True Then                        If System.windows.Forms.Cursor.position.X >= clIEn()(0) - 5 And (System.windows.Forms.Cursor.position.Y >= Me.top And System.windows.Forms.Cursor.position.Y <= Me.top + Me.Height) Then                                Me.left = clIEn()(0) - Me.WIDth                        End If                End If                If tt = True Then                        If System.windows.Forms.Cursor.position.Y <= 1 And (System.windows.Forms.Cursor.position.X >= Me.left And System.windows.Forms.Cursor.position.X <= Me.left + Me.WIDth) Then                                Me.top = 1                        End If                End If        End Sub        Private Sub MainWindow_MouseEnter(sender As Object,e As System.windows.input.MouseEventArgs) Handles Me.MouseEnter                                    If hh = True Then                                Me.left = clIEn()(0) - Me.WIDth                                hh = False                        End If                        If tt = True Then                                Me.top = 1                                tt = False                        End If        End Sub        Function clIEn()                Return {System.windows.Forms.Screen.FromPoint(New System.Drawing.Point).Bounds.WIDth,System.windows.Forms.Screen.FromPoint(New System.Drawing.Point).Bounds.Height}        End Function        Private Sub MainWindow_MouseLeave(sender As Object,e As System.windows.input.MouseEventArgs) Handles Me.MouseLeave                If Me.top <= 1 And Me.left + Me.WIDth >= clIEn()(0) Then                        Me.top = -Me.Height + 5                        Me.left = clIEn()(0) - Me.WIDth                        tt = True                Else                        hIDden()                        shhtop()                End If        End Sub        Sub hIDden()                If Me.left + Me.WIDth >= clIEn()(0) Then                        Me.left = clIEn()(0) - 5                        hh=True                End If        End Sub        Sub shhtop()                If Me.top <= 1 Then                        Me.top = -Me.Height + 5                        tt = True                End If        End SubEnd Class
总结

以上是内存溢出为你收集整理的.net (vb) wpf 模仿QQ 吸附窗体全部内容,希望文章能够帮你解决.net (vb) wpf 模仿QQ 吸附窗体所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1290768.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-09
下一篇 2022-06-09

发表评论

登录后才能评论

评论列表(0条)

保存