Salut,
Une petite recherche :
'Merci Badrbadr (
http://www.csharpfr.com/codes/ROUNDEDRECTANGLE-CREEZ-RECTANGLES-AVEC-COINS-ARRONDIS_35392.aspx)
Private
Function
GetRoundedRectPath(
ByVal
Rect
As
System.Drawing.Rectangle,
ByVal
Radius
As
Integer
)
As
System.Drawing.Drawing2D.GraphicsPath
Dim
Diameter
As
Integer
= 2 * Radius
Dim
ArcRect
As
New
System.Drawing.Rectangle(Rect.Location,
New
Size(Diameter, Diameter))
Dim
Path
As
New
System.Drawing.Drawing2D.GraphicsPath()
Path.AddArc(ArcRect, 180, 90)
ArcRect.X = Rect.Right - Diameter
Path.AddArc(ArcRect, 270, 90)
ArcRect.Y = Rect.Bottom - Diameter
Path.AddArc(ArcRect, 0, 90)
ArcRect.X = Rect.Left
Path.AddArc(ArcRect, 90, 90)
Path.CloseFigure()
Return
Path
End
Function
Pour l'utilisation :
Dim
MonBitMap
As
New
System.Drawing.Bitmap(Larg, Haut)
'puis je dessine dedans en utilisant un graphics
Dim
MonObjGfx
As
System.Drawing.Graphics = System.Drawing.Graphics.FromImage(MonBitMap)
MonObjGfx.DrawPath(Pens.Red, GetRoundedRectPath(
New
System.Drawing.Rectangle(0, 0, 50, 50), 6))
Kenji