03-02-25, 02:26 PM
السلام عليكم ورحمة الله وبركاته
اخوتي الاعزاء
الان اريد تغير شكل الليبول بوكس بشكل غير المسطيل او المربع وليكون مثلا دائري او يصبح علي شكل مثلث او غيره فهل يوجد كود او طريقة لتغير الشكل شكرا للجميع
Private Sub Form1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim shape As New System.Drawing.Drawing2D.GraphicsPath
shape.AddEllipse(0, 0, Me.Width, Me.Height)
Me.Region = New System.Drawing.Region(shape)
End Sub
Private Sub Button1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Button1.Paint
Dim shape As New System.Drawing.Drawing2D.GraphicsPath
shape.AddEllipse(0, 0, Button1.Width, Button1.Height)
Button1.Region = New System.Drawing.Region(shape)
End Sub
Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
Dim shape As New System.Drawing.Drawing2D.GraphicsPath
shape.AddEllipse(0, 0, Panel1.Width, Panel1.Height)
Panel1.Region = New System.Drawing.Region(shape)
End Sub
Private Sub PictureBox1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
Dim shape As New System.Drawing.Drawing2D.GraphicsPath
shape.AddEllipse(0, 0, PictureBox1.Width, PictureBox1.Height)
PictureBox1.Region = New System.Drawing.Region(shape)
End Sub
Private Sub DataGridView1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles DataGridView1.Paint
Dim shape As New System.Drawing.Drawing2D.GraphicsPath
shape.AddEllipse(0, 0, DataGridView1.Width, DataGridView1.Height)
DataGridView1.Region = New System.Drawing.Region(shape)
End SubImports System.Drawing.Drawing2D
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim path As New GraphicsPath()
path.AddEllipse(0, 0, Label1.Width, Label1.Height)
Label1.Region = New Region(path)
End Sub
End Class
Imports System.Drawing.Drawing2D
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim path As New GraphicsPath()
Dim points As Point() = {
New Point(Label1.Width \ 2, 0), ' النقطة العلوية
New Point(0, Label1.Height), ' الزاوية اليسرى السفلية
New Point(Label1.Width, Label1.Height) ' الزاوية اليمنى السفلية
}
path.AddPolygon(points)
Label1.Region = New Region(path)
End Sub
End Class
Dim path As New GraphicsPath()
path.AddEllipse(0, 0, PictureBox1.Width, PictureBox1.Height)
PictureBox1.Region = New Region(path)