|
Public Class Form1
Inherits System.Windows.Forms.Form Vom Windows Form Designer generierter Code
Private CurrentPosition As New System.Drawing.Point
Private MouseButton As System.Windows.Forms.MouseButtons = _
Nothing
#Region " Form und Buttons formen "
Protected Overrides Sub OnPaint( _
ByVal e As System.Windows.Forms.PaintEventArgs)
'Ellipse_Form
Dim shape As New System.Drawing.Drawing2D.GraphicsPath
shape.AddEllipse(0, 0, Me.Width, Me.Height)
Me.Region = New System.Drawing.Region(shape)
'Ellipse_Button
Dim shapeB As New System.Drawing.Drawing2D.GraphicsPath
shapeB.AddEllipse(2, 2, Button1.Width - 5, Button1.Height - 5)
Button1.Region = New System.Drawing.Region(shapeB)
Button2.Region = New System.Drawing.Region(shapeB)
'Form_Umrandungen
Dim gF As Graphics
gF = Me.CreateGraphics()
Dim RectF As New Rectangle(0, 0, Me.Width, Me.Height)
Dim PenF As New Pen(Color.FromArgb(132, 130, 255), 10)
gF.DrawEllipse(PenF, RectF)
End Sub
#End Region
#Region " Form mit der Maus bewegen "
Private Overloads Sub OnMouseDown( _
ByVal Sender As System.Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles MyBase.MouseDown
MyClass.MouseButton = e.Button()
With MyClass.CurrentPosition
.X = e.X()
.Y = e.Y()
End With
End Sub
Private Overloads Sub OnMouseUp( _
ByVal Sender As System.Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles MyBase.MouseUp
MyClass.MouseButton = Nothing
End Sub
Private Overloads Sub OnMouseMove( _
ByVal Sender As System.Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles MyBase.MouseMove
Select Case MyClass.MouseButton
Case Is = MouseButtons.Left
MyClass.Top = MyClass.Cursor.Position.Y() - _
MyClass.CurrentPosition.Y()
MyClass.Left = MyClass.Cursor.Position.X() - _
MyClass.CurrentPosition.X()
Case Is = Nothing
Exit Sub
End Select
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
MyClass.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button2.Click
Me.WindowState = FormWindowState.Minimized
End Sub
End Class
|
|