كود :
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'width10_ = Val(width_.Text)
Dim Img As Bitmap = New Bitmap(NumericUpDown1.Value, NumericUpDown2.Value)
Using g As Graphics = Graphics.FromImage(Img)
g.DrawRectangle(Pens.Blue, 50, 50, 200, 200)
'*****************************************************************************************
g.DrawRectangle(Pens.Blue, 60, 60, 80, 80)
'رسم خط مائل
g.DrawLine(Pens.Blue, 50, 50, 60, 60)
'رسم البعد الراسى
g.DrawLine(Pens.Red, 40, 50, 40, 90)
g.DrawLine(Pens.Red, 40, 110, 40, 150)
'رسم راس السهم العلوى
g.DrawLine(Pens.Red, 40, 50, 35, 60)
g.DrawLine(Pens.Red, 40, 50, 45, 60)
'رسم راس السهم السفلى
g.DrawLine(Pens.Red, 40, 150, 35, 140)
g.DrawLine(Pens.Red, 40, 150, 45, 140)
'رسم البعد الافقى
g.DrawLine(Pens.Red, 50, 160, 90, 160)
g.DrawLine(Pens.Red, 110, 160, 150, 160)
'رسم راس السهم
g.DrawLine(Pens.Red, 50, 160, 60, 155)
g.DrawLine(Pens.Red, 50, 160, 60, 165)
g.DrawLine(Pens.Red, 150, 160, 145, 155)
g.DrawLine(Pens.Red, 150, 160, 145, 165)
'PictureBox1.CreateGraphics().DrawPie(Pens.Blue, 160, 160, 100, 100, 180, 180)
Dim str As String = width_.Text
Dim fnt As New Font("Times New Roman", 10, FontStyle.Regular)
Dim pnt As New Point(87, 152)
g.DrawString(str, fnt, Brushes.Red, pnt)
Dim str2 As String = hight_.Text
Dim fnt2 As New Font("Times New Roman", 10, FontStyle.Regular)
Dim pnt2 As New Point(25, 95)
g.DrawString(str2, fnt2, Brushes.Red, pnt2)
g.FillRectangle(Brushes.Red, 50, 50, 100, 100)
g.FillRectangle(Brushes.White, 60, 60, 80, 80)
End Using
Me.PictureBox1.Image = Img
End Sub