04-02-25, 02:19 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 Sub