السلام عليكم ورحمة الله وبركاته
اقدم لكم ابسط طريقة لتغيير شكل الفورم وعمل حافات سلسة كما في الصورة
وبالطبع يمكنك تغيير كل شي وتعدل عالكود حسب ماتحب
افتح مشروع جديد وضع هذا الكود
اقدم لكم ابسط طريقة لتغيير شكل الفورم وعمل حافات سلسة كما في الصورة
وبالطبع يمكنك تغيير كل شي وتعدل عالكود حسب ماتحب
افتح مشروع جديد وضع هذا الكود
كود :
'3booody///vb4arb.com
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim p() As Point = {New Point(20, 0), New Point(Me.Width - 20, 0), New Point(Me.Width - 20, Me.Height), New Point(20, Me.Height)}
Dim GRP As New Drawing2D.GraphicsPath
GRP.AddClosedCurve(p)
e.Graphics.FillPath(mx(ClientRectangle, Color.Cyan, Color.Purple), GRP) 'ملئ الفورم بالالوان
Me.Region = New Region(GRP)
e.Graphics.DrawLine(New Pen(Color.White, 2), 0, 40, Me.Width, 40) '
e.Graphics.DrawLine(New Pen(Color.Black, 1), 0, 39, Me.Width, 39)
For i As Integer = 0 To Me.Width Step 2
e.Graphics.DrawLine(Pens.Purple, i, 0, i, 39)
Next
GRP.Dispose()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
FormBorderStyle = Windows.Forms.FormBorderStyle.None 'جعل الفورم بالشكل الاعتيادي
End Sub
'دالة تعمل على التدرج اللوني
Function mx(ByVal Rec As Rectangle, ByVal clr1 As Color, ByVal clr2 As Color) As Drawing2D.LinearGradientBrush
Return New Drawing2D.LinearGradientBrush(Rec, clr1, clr2, Drawing2D.LinearGradientMode.BackwardDiagonal)
End Function
#Region "Move" 'لتحريك الفورم من الاعلى
Dim b As Boolean = False
Dim x, y As Integer
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
If Not e.Y < 40 Then Return
b = True
x = e.X : y = e.Y
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If b Then
Me.Location = New Point(Me.Location.X + e.X - x, Me.Location.Y + e.Y - y)
End If
End Sub
Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
b = False
End Sub
#End Region