1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
MyBase.OnPaint(e)
S_Ecrire()
End Sub
Private Sub S_Ecrire()
Dim pen As New Pen(Color.Black, 10)
Dim G As Graphics
Dim Rect As RectangleF
Dim PT As New PointF(50, 50)
Dim Sz As New SizeF(200, 50)
Dim Ft As New StringFormat
Ft.Alignment = StringAlignment.Center
Ft.LineAlignment = StringAlignment.Center
Rect = New RectangleF(PT, Sz)
G = Panel1.CreateGraphics
G.DrawString("Ecrire texte sur panel", New Font("Arial", 14, FontStyle.Italic), Brushes.Blue, Rect, Ft)
G.DrawRectangle(Pens.Aqua, 50, 50, 200, 50)
G.Dispose()
pen.Dispose()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Invalidate()
End Sub |
Partager