UDF > GDIPlus > Pen >


_GDIPlus_PenSetMiterLimit

Définit la limite de la mitre relative à un objet crayon

#include <GDIPlus.au3>
_GDIPlus_PenSetMiterLimit ( $hPen, $fMiterLimit )

Paramètres

$hPen Handle d'un objet Pen
$fMiterLimit Nombre réel qui spécifie la limite de mitre de l'objet Pen.
Une valeur inférieure à 1.0 est remplacée par 1.0.

Valeur de retour

Succès: Retourne True.
Échec: Retourne False et définit @error <> 0, @extended contient le code erreur GPSTATUS ($GPID_ERR*).

Remarque

La longueur de la mitre est la distance entre les deux points d'intersection des parois de deux lignes qui se rencontrent.
La longueur de la mitre peut être grande quand l'angle formé par les deux lignes est faible.
La limite de mitre est le rapport maximum autorisé entre la longueur de la mitre et la largeur de ligne.

En relation

_GDIPlus_PenGetMiterLimit

Voir aussi

Cherchez GdipSetPenMiterLimit dans la Library MSDN.

Exemple

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $hGUI, $hGraphic, $hPen, $fPenWidth, $hPath

    ; Crée une GUI
    $hGUI = GUICreate("GDI+", 800, 600)
    GUISetState(@SW_SHOW)

    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;Créez un objet graphique à partir d'un handle fenêtre
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;Définit l'objet graphique la qualité de rendu (antialiasing)
    _GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF)

    $hPath = _GDIPlus_PathCreate() ;Création d'un objet chemin
    _GDIPlus_PathAddLine($hPath, 30, 550, 70, 200)
    _GDIPlus_PathAddLine($hPath, 70, 200, 110, 550)

    $fPenWidth = 32

    Local $hPen1 = _GDIPlus_PenCreate(0xFF00FF00, 1)
    For $i = 0 To 6
        _GDIPlus_GraphicsDrawLine($hGraphic, 0, 200 - $fPenWidth * 0.5 * $i, 800, 200 - $fPenWidth * 0.5 * $i, $hPen1)
    Next

    $hPen = _GDIPlus_PenCreate(0xFF8800AA, $fPenWidth)
    For $i = 1 To 6
        _GDIPlus_PenSetMiterLimit($hPen, $i)
        _GDIPlus_GraphicsDrawString($hGraphic, "MiterLimit: " & StringFormat("%.1f", _GDIPlus_PenGetMiterLimit($hPen)), 10, 10)
        _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen)
        _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen1)
        _GDIPlus_GraphicsTranslateTransform($hGraphic, 130, 0)
    Next

    ; Boucle jusqu'à ce que l'utilisateur quitte.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ;Nettoyer les ressources
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_PenDispose($hPen1)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example