1
在VB6我有下面的代碼來停靠一個窗口:需要screen.width和screen.height相當於VB的vb.net
Public Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If IsBeingDragged = True And Button = MouseButtons.Left Then
'if the drag flag is true and left mouse button is pressed...
'set Left side docking
If Me.Left + (x - Xs) < DockScale Then
Me.Left = 0
Exit Sub
End If
'set Top side docking
If Me.Top + (y - Ys) < DockScale Then
Me.Top = 0
Exit Sub
End If
'set right side docking
If Me.Left + (x - Xs) + Me.Width > (Screen.Width - DockScale) Then
Me.Left = Screen.Width - Me.Width
Exit Sub
End If
'set bottom side docking
If Me.Top + (y - Ys) + Me.Height > (Screen.Height - DockScale) Then
Me.Top = Screen.Height - Me.Height
Exit Sub
End If
'move the form finally
Me.Left = Me.Left + (x - Xs)
Me.Top = Me.Top + (y - Ys)
End If
End Sub
我使用vb.net現在,當我試圖複製並粘貼我的代碼告訴我,screen.widht和screen.height不是system.window.form.screen的成員,在vb.net上是否有與此等效的內容?