Ajoute une ligne à la figure actuelle
#include <GDIPlus.au3>
_GDIPlus_PathAddLine ( $hPath, $nX1, $nY1, $nX2, $nY2 )
$hPath | Handle de l'objet GraphicsPath |
$nX1 | La coordonnée X du point de départ de la ligne |
$nY1 | La coordonnée Y du point de départ de la ligne |
$nX2 | La coordonnée X du point d'arrivée de la ligne |
$nY2 | La coordonnée Y du point d'arrivée de la ligne |
Succès: | Retourne True. |
Échec: | Retourne False et définit @error <> 0, @extended contient le code erreur ($GPID_ERR*). |
Consultez GdipAddPathLine dans la Librairie MSDN.
#include <GDIPlus.au3> #include <GUIConstantsEx.au3> Example() Func Example() Local $hGUI, $hGraphic, $hBrush, $hPen, $hPath, $hPath_Clone, $hMatrix ; Crée une GUI $hGUI = GUICreate("GDI+", 800, 400) GUISetState(@SW_SHOW) _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ; Crée un objet graphique à partir du handle de la fenêtre _GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ; Définit pour l'objet graphique la qualité de rendu antialiasing _GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF) $hBrush = _GDIPlus_BrushCreateSolid(0x7F8800AA) $hPen = _GDIPlus_PenCreate(0xFF8800AA, 2) $hPath = _GDIPlus_PathCreate() ; Crée un objet path _GDIPlus_PathAddLine($hPath, 106, 330, 200, 40) _GDIPlus_PathAddLine($hPath, 294, 330, 48, 151) _GDIPlus_PathAddLine($hPath, 352, 151, 106, 330) $hPath_Clone = _GDIPlus_PathClone($hPath) ; Créez une copie de la figure $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, 400, 0) _GDIPlus_PathTransform($hPath_Clone, $hMatrix) _GDIPlus_PathWindingModeOutline($hPath_Clone) ; Aperçu _GDIPlus_GraphicsDrawString($hGraphic, "original path of 3 connected lines", 40, 10) _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ; Dessine le Path avec le handle Graphic (GUI) _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ; Dessine le Path avec le handle Graphic (GUI) _GDIPlus_GraphicsDrawString($hGraphic, "WindingModeOutline", 440, 10) _GDIPlus_GraphicsFillPath($hGraphic, $hPath_Clone, $hBrush) ; Dessine le Path avec le handle Graphic (GUI) _GDIPlus_GraphicsDrawPath($hGraphic, $hPath_Clone, $hPen) ; Dessine le Path avec le handle Graphic (GUI) ; Boucle jusqu'à ce que l'utilisateur quitte. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Nettoie les ressources _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_PathDispose($hPath) _GDIPlus_PathDispose($hPath_Clone) _GDIPlus_BrushDispose($hBrush) _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Example