RECTANGLES ARRONDIS

cs_sirene2005 Messages postés 16 Date d'inscription mardi 18 octobre 2005 Statut Membre Dernière intervention 25 août 2006 - 8 août 2006 à 13:38
cs_claudetom Messages postés 115 Date d'inscription jeudi 11 octobre 2001 Statut Membre Dernière intervention 15 octobre 2012 - 16 oct. 2012 à 20:29
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.

https://codes-sources.commentcamarche.net/source/38893-rectangles-arrondis

cs_claudetom Messages postés 115 Date d'inscription jeudi 11 octobre 2001 Statut Membre Dernière intervention 15 octobre 2012
16 oct. 2012 à 20:29
Ajout coins en biseaux !
vous lui passez le rectangle et retourne la figure (Path)
suffit d'ajouter une condition au début de la function ToGraphicsPath
exemple une propriété choix (rounded/Ligne)

Public Function AddAnglesCorners(ByVal BaseRect As RectangleF) As GraphicsPath
Dim MyPath As New Drawing2D.GraphicsPath()
Dim points(7) As Point
'TopLeft
points(0) = New Point(CInt(BaseRect.Left + RoundedCorner.TopLeft), CInt(BaseRect.Top))
'TopRight
points(1) = New Point(CInt(BaseRect.Right - RoundedCorner.TopRight), CInt(BaseRect.Top))
points(2) = New Point(CInt(BaseRect.Right), CInt(BaseRect.Top + RoundedCorner.TopRight))
'BottomRight
points(3) = New Point(CInt(BaseRect.Right), CInt(BaseRect.Bottom - RoundedCorner.BottomRight))
points(4) = New Point(CInt(BaseRect.Right - RoundedCorner.BottomRight), CInt(BaseRect.Bottom))
'BottomLeft
points(5) = New Point(CInt(BaseRect.Left + RoundedCorner.BottomLeft), CInt(BaseRect.Bottom))
points(6) = New Point(CInt(BaseRect.Left), CInt(BaseRect.Bottom - RoundedCorner.BottomLeft))
'TopLeft
points(7) = New Point(CInt(BaseRect.Left), CInt(BaseRect.Top + RoundedCorner.TopLeft))
With MyPath
.AddLines(points)
.CloseFigure()
End With
Return MyPath
End Function
cs_eldim Messages postés 956 Date d'inscription lundi 30 mai 2005 Statut Membre Dernière intervention 21 août 2014 1
16 oct. 2012 à 20:12
Bonjour,

remplace les draw arc par des fonctions de dessin de ton choix
cs_claudetom Messages postés 115 Date d'inscription jeudi 11 octobre 2001 Statut Membre Dernière intervention 15 octobre 2012
15 oct. 2012 à 23:19
Bonjour question peut-être bête ?
Mais je cherche la même chose sauf que les coins au lieu d’être arrondis, je les veux en biseaux en fonction de la valeur RoundedCorner
TopLeft,TopRight,BottomLeft,BottomRight.
en utilisant biensure toujours GraphicsPath
Merci
cs_mic Messages postés 77 Date d'inscription mardi 5 février 2002 Statut Membre Dernière intervention 19 septembre 2012
19 sept. 2012 à 18:50
Merci d'avoir mi ce code en ligne
andreafar Messages postés 1 Date d'inscription mardi 3 août 2010 Statut Membre Dernière intervention 22 août 2010
22 août 2010 à 14:30
Super. Elle marche très bien chez moi.
cs_sirene2005 Messages postés 16 Date d'inscription mardi 18 octobre 2005 Statut Membre Dernière intervention 25 août 2006
8 août 2006 à 13:38
votre programme est bon mais si tu enrichie avec d'autre forme
bon courage
Rejoignez-nous