السلام عليكم
هذا الموضوع استكمال لدورة الاكواد الشاملة
'59-رسم خط على الفورم
كود PHP:
Public Class Form1
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim bit As Bitmap = New Bitmap(Me.Width, Me.Height)
Dim g As Graphics = Graphics.FromImage(bit)
Dim myPen As Pen = New Pen(Color.Blue, 3)
Me.CreateGraphics.DrawLine _
(myPen, 0, 0, Me.Width, Me.Height)
End Sub
End Class
'59-رسم خط على الفورم
'60- رسم مجموعة خطوط على الفورم
كود PHP:
Imports System.Drawing.Drawing2D
Public Class Form1
Protected Overrides Sub OnPaint _
(ByVal e As PaintEventArgs)
Dim G As Graphics = e.Graphics
Dim PtsA As Point() = {New Point(10, 10), _
New Point(150, 150), New Point(400, 10)}
Dim PtsB As Point() = {New Point(10, 40), _
New Point(150, 180), New Point(400, 40)}
Dim PtsC As Point() = {New Point(10, 70), _
New Point(150, 210), New Point(400, 70)}
Dim PtsD As Point() = {New Point(10, 100), _
New Point(150, 240), New Point(400, 100)}
Dim P As Pen = New Pen(Color.Blue, 10)
G.SmoothingMode = SmoothingMode.AntiAlias
P.LineJoin = LineJoin.Bevel
G.DrawLines(P, PtsA)
P.LineJoin = LineJoin.Miter
G.DrawLines(P, PtsB)
P.LineJoin = LineJoin.MiterClipped
G.DrawLines(P, PtsC)
P.LineJoin = LineJoin.Round
G.DrawLines(P, PtsD)
End Sub
End Class
'60- رسم مجموعة خطوط على الفورم