|
Kako da u vb.net-u vucem formu kad stavim FormBorderStyle na None
Pozdrav
Dopuna: 12 Nov 2005 11:12
Problem resen
Kod:
Dim newPoint As New System.Drawing.Point()
Dim a As Integer
Dim b As Integer
Public ScreenWidth As Integer = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width
Public screenHeight As Integer = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height
Private Sub ResizeMe_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ResizeMe.MouseMove
If e.Button = MouseButtons.Left Then
Me.SetBounds(Me.Location.X, Me.Location.Y, (Me.MousePosition.X - (Me.Left)) + 10, (Me.MousePosition.Y - Me.Top) + 10)
FormInfo.Text = "Form Information" & vbCrLf & "Width: " & Me.Width & vbCrLf & "Height: " & Me.Height _
& vbCrLf & "Form Location: " & Me.Location.ToString & vbCrLf & "Mouse Position: " & Me.MousePosition.ToString
Me.Refresh()
End If
End Sub
Private Sub CloseMe_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseMe.Click
Me.Close()
End Sub
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
a = Me.MousePosition.X - Me.Location.X
b = Me.MousePosition.Y - Me.Location.Y
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
If e.Button = MouseButtons.Left Then
FormInfo.Text = "Form Information" & vbCrLf & "Width: " & Me.Width & vbCrLf & "Height: " & Me.Height _
& vbCrLf & "Form Location: " & Me.Location.ToString & vbCrLf & "Mouse Position: " & Me.MousePosition.ToString
newPoint = Me.MousePosition
newPoint.X = newPoint.X - (a)
newPoint.Y = newPoint.Y - (b)
Me.Location = newPoint
'Docks Form top left and right corners
If Me.Location.X < 8 And Me.Location.Y < 8 Then
Me.Location = New System.Drawing.Point(0, 0)
End If
If Me.Location.X > (ScreenWidth - (Me.Size.Width)) + 8 And Me.Location.Y < 8 Then
Me.Location = New Point(ScreenWidth - Me.Size.Width, 0)
End If
Else
FormInfo.Text = "Form Information" & vbCrLf & "Width: " & Me.Width & vbCrLf & "Height: " & Me.Height _
& vbCrLf & "Form Location: " & Me.Location.ToString & vbCrLf & "Mouse Position: " & Me.MousePosition.ToString
End If
End Sub
End Class
|