[Howto] Borderlose Form ( Eigenes Design und verschiebbar ) Verfasst am: 09.08.2009, 21:50
1)Stellt die Form auf Borderstyle = NONE.
2) Danach macht ihr auf die Form eine Hintergrundfarbe die sonst nicht im Style gebraucht wird, dann unten auf TransparencyKey die gleiche rein.
3) Dann fügt ihr euer designtes Fenster als Image auf die Form und passt es an.
4) Nun erstellt ihr einen Close und einen Minimize bzw Maximize Image und legt sie auf den Background ( VORSICHT ! Dieses Image darf keine Transparenz enthalten, sonst habt ihr dort wo die Transparenz ist Löcher ! )
Nun kann man die Form noch nicht bewegen , das ändert ihr durch diesen Code. Fügt in einfach irendgwo ein:
Visual Basic: [code] Private _move As Boolean = False
Dim differencePoint As New Point
Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
_move = True
differencePoint = e.Location
End Sub
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
If _move Then
Dim newX As Int32 = (Me.Location.X - differencePoint.X) + (e.X)
Dim newY As Int32 = (Me.Location.Y - differencePoint.Y) + (e.Y)
Me.Location = New Point(newX, newY)
End If
End Sub
Private Sub PictureBox1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp
_move = False
End Sub[/code]