Paint

  • Hallo,

    ich würde gerne eine Art Paint in Autoit Programmieren,wie würdet ihr dies machen?

    LG Pceumel

    Einmal editiert, zuletzt von pceumel (8. Dezember 2008 um 19:47)

  • Also ich würde mir erstmal die _GDIPlus Funktionen anschauen. Damit kannst du nämlich z.B. Linien "malen" von Punkt zu Punkt (" _GDIPlus_GraphicsDrawLine")

    .. Nur so als kleiner Starttipp ;)

    • Offizieller Beitrag

    Ich habe mein Beispiel aus Deiner anderen Frage mal auf Mausbedienung umgeschrieben:

    Spoiler anzeigen
    [autoit]


    #include<Misc.au3>
    #include<GuiConstantsEx.au3>
    #include<GDIPlus.au3>
    Opt('MouseCoordMode', 2)
    _Main()

    [/autoit] [autoit][/autoit] [autoit]

    Func _Main()
    Local $hGUI, $hWnd, $hGraphic, $hPen, $aPos[2], $aOldPos[2]
    Local $width = @DesktopWidth, $height = @DesktopHeight
    Local $dll = DllOpen('user32.dll')
    $hGUI = GUICreate('GDI+', $width, $height)
    $hWnd = WinGetHandle('GDI+')
    GUISetState()
    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
    $hPen = _GDIPlus_PenCreate(0xff00ff00, 2)
    $timer = TimerInit()
    Do
    $aPos = MouseGetPos()
    If _IsPressed('01', $dll) Then
    _GDIPlus_GraphicsDrawLine($hGraphic, $aOldPos[0], $aOldPos[1], $aPos[0], $aPos[1], $hPen)
    If TimerDiff($timer) > 500 Then
    _GDIPlus_PenSetColor($hPen, '0xFF' & StringRight(Hex(Random(0, 16777215, 1)), 6))
    $timer = TimerInit()
    EndIf
    EndIf
    $aOldPos[0] = $aPos[0]
    $aOldPos[1] = $aPos[1]
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    ; Clean up resources
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
    DllClose($dll)
    EndFunc ;==>_Main

    [/autoit]

    Edit: es fehlte noch ein: Opt('MouseCoordMode', 2)