• Hallo Com,
    ich habe heute auch mal ein Graphenzeichnenscript geschrieben. Ich weiß auch, dass es das schon öfters hier gab;
    Dennoch wollte ich euch meine Version einmal vorstellen, um auf Bugs, Fehler und Verbesserungsvorschläge aufmerksam gemacht zu werden.
    Es gibt ein Menü, man kann Markierungen setzen und Graphen in versch. Farben zeichnen!

    Script
    [autoit]


    #include <ButtonConstants.au3>
    #include <SliderConstants.au3>
    #include <GuiSlider.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <Misc.au3>
    #include <GDIPlus.au3>
    #include <SliderConstants.au3>
    #include <GuiListView.au3>
    #include <Array.au3>

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

    ;###User Options Start
    $sCoordfarbe = "0xFF800000" ;Gitterfarbe in ARGB
    $sGridColor = "0xFF99FFFF" ;Koordinatensystemfarbe in ARGB
    $sBackgroundcolor = "0x000000" ;Hintergrundfarbe in RGB
    $sXColor = "0xFFFFFFFF" ;Farbe der X, die beim Klicken erscheinen in ARGB
    $iLineWidth = 6 ;Graphenlinienbreite
    ;###User Options Ende

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

    ;###Options Start
    Opt("GuiOnEventMode", 1)
    HotKeySet("{ESC}", "ende")
    OnAutoItExitRegister("ende")
    Const $iNullx = Round(@DesktopWidth / 2)
    Const $iNully = Round(@DesktopHeight / 2)
    $sTitle = "Funktionsgraph"
    $sTitle2 = "Einstellungsmenü"
    $bDrawed = False
    ;###Options Ende

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

    ;###Gui Start
    $hGui = GUICreate($sTitle, @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW)
    GUISetBkColor($sBackgroundcolor, $hGui)
    GUISetState(@SW_SHOW, $hGui)
    ;Neue Gui:
    $hSettings = GUICreate($sTitle2, 350, 280, @DesktopWidth - 350, @DesktopHeight - 280, BitOR($WS_CAPTION, $WS_GROUP), $WS_EX_TOPMOST, $hGui)
    GUISetBkColor(0xFFFFFF, $hSettings)
    $cMousePos = GUICtrlCreateLabel("MousePos:", 0, 0, 300, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
    $cCGrid = GUICtrlCreateCheckbox("Grid", 0, 25, 50, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
    GUICtrlSetState(-1, $GUI_CHECKED)
    $cCUnitCircle = GUICtrlCreateCheckbox("Unit Circle", 52, 25, 85, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
    $cCScale = GUICtrlCreateCheckbox("Scale", 140, 25, 60, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
    GUICtrlSetState(-1, $GUI_CHECKED)
    GUICtrlCreateButton("Generate", 202, 25, 80, 20)
    GUICtrlSetOnEvent(-1, "generate")
    GUICtrlCreateButton("Add function", 0, 60, 90, 20)
    GUICtrlSetOnEvent(-1, "addfunc")
    GUICtrlCreateButton("Delete function", 95, 60, 100, 20)
    GUICtrlSetOnEvent(-1, "deletefunc")
    GUICtrlCreateButton("Quit", 200, 60, 100, 20)
    GUICtrlSetOnEvent(-1, "ende")
    $cObjektlist = GUICtrlCreateListView("Objekttyp |Wert |Farbe ", 0, 82, 300, 140)
    $cZoom = GUICtrlCreateSlider(310, 55, 25, 165, $TBS_VERT)
    GUICtrlSetLimit(-1, 200, 1)
    GUICtrlSetData($cZoom, 20)
    $cZoomlabel = GUICtrlCreateLabel("Zoom:" & @CRLF & GUICtrlRead($cZoom), 296, 0, 40, 60)
    GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
    For $i = 10 To 200 Step 10
    _GUICtrlSlider_SetTic($cZoom, $i)
    Next
    $cButtonBk = GUICtrlCreateButton("Background", 0, 230, 60, 20)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, $sBackgroundcolor)
    GUICtrlSetOnEvent(-1, "setbk")
    $cButtonSystem = GUICtrlCreateButton("System", 65, 230, 40, 20)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, StringReplace($sCoordfarbe, "0xFF", "0x"))
    GUICtrlSetOnEvent(-1, "setsystem")
    $cButtonGrid = GUICtrlCreateButton("Grid", 110, 230, 30, 20)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, StringReplace($sGridColor, "0xFF", "0x"))
    GUICtrlSetOnEvent(-1, "setgrid")
    $cButtonMark = GUICtrlCreateButton("Mark", 145, 230, 30, 20)
    GUICtrlSetColor(-1, 0x000000)
    GUICtrlSetBkColor(-1, StringReplace($sXColor, "0xFF", "0x"))
    GUICtrlSetOnEvent(-1, "setmark")

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

    ControlFocus($sTitle2, "", $cObjektlist)
    GUISetState(@SW_SHOW, $hSettings)
    ;###Gui Ende

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

    ;###GDIPlus Start
    _GDIPlus_Startup()
    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
    $Pen2 = _GDIPlus_PenCreate($sGridColor, 1)
    $Pen1 = _GDIPlus_PenCreate($sCoordfarbe, 1)
    $Pen3 = _GDIPlus_PenCreate($sXColor, 1)
    $Brush1 = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    ;###GDIPlus Ende

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

    ;generate()

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

    While 1
    $aPos = MouseGetPos()
    $iZoom = GUICtrlRead($cZoom) ;Zoom
    $iAbstand = Round(@DesktopHeight / $iZoom)
    GUICtrlSetData($cMousePos, "Mousepos: (" & Round(($aPos[0] - $iNullx) / $iAbstand, 2) & "|" & Round(calcytocoords($aPos[1]) / $iAbstand, 2) & ")")
    If _IsPressed(01) Then
    drawX()
    Do
    Until Not _IsPressed(01)
    EndIf
    GUICtrlSetData($cZoomlabel, "Zoom:" & @CRLF & GUICtrlRead($cZoom))
    Sleep(100)
    WEnd
    ende()

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

    Func generate()
    GUISetBkColor($sBackgroundcolor, $hGui)
    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
    If GUICtrlRead($cCGrid) = $GUI_CHECKED Then
    $bGrid = True
    Else
    $bGrid = False
    EndIf

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

    If GUICtrlRead($cCScale) = $GUI_CHECKED Then
    $bScale = True
    Else
    $bScale = False
    EndIf

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

    If GUICtrlRead($cCUnitCircle) = $GUI_CHECKED Then
    $bEinheitskreis = True
    Else
    $bEinheitskreis = False
    EndIf
    ;###Netz erstellen Start
    For $i = 1 To @DesktopWidth / $iAbstand ;Beschriftung
    If $bGrid = True Then
    _GDIPlus_GraphicsDrawLine($hGraphics, $iNullx + $iAbstand * $i, 0, $iNullx + $iAbstand * $i, @DesktopHeight, $Pen2) ;x rechts
    _GDIPlus_GraphicsDrawLine($hGraphics, 0, $iNully - $iAbstand * $i, @DesktopWidth, $iNully - $iAbstand * $i, $Pen2);y oben
    _GDIPlus_GraphicsDrawLine($hGraphics, 0, $iNully + $iAbstand * $i, @DesktopWidth, $iNully + $iAbstand * $i, $Pen2);y unten
    _GDIPlus_GraphicsDrawLine($hGraphics, $iNullx - $iAbstand * $i, 0, $iNullx - $iAbstand * $i, @DesktopWidth, $Pen2);x links
    EndIf

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

    If $bScale = True Then
    _GDIPlus_GraphicsDrawLine($hGraphics, $iNullx + $iAbstand * $i, $iNully - 10, $iNullx + $iAbstand * $i, $iNully + 10, $Pen1) ;x rechts
    _GDIPlus_GraphicsDrawLine($hGraphics, $iNullx - 10, $iNully - $iAbstand * $i, $iNullx + 10, $iNully - $iAbstand * $i, $Pen1);y oben
    _GDIPlus_GraphicsDrawLine($hGraphics, $iNullx - 10, $iNully + $iAbstand * $i, $iNullx + 10, $iNully + $iAbstand * $i, $Pen1);y unten
    _GDIPlus_GraphicsDrawLine($hGraphics, $iNullx - $iAbstand * $i, $iNully - 10, $iNullx - $iAbstand * $i, $iNully + 10, $Pen1);x links
    EndIf
    Next
    _GDIPlus_GraphicsDrawLine($hGraphics, 0, $iNully, @DesktopWidth, $iNully, $Pen1) ;x-Achse
    _GDIPlus_GraphicsDrawLine($hGraphics, $iNullx, 0, $iNullx, @DesktopHeight, $Pen1);y-Achse
    If $bEinheitskreis = True Then
    _GDIPlus_GraphicsDrawEllipse($hGraphics, $iNullx - ($iAbstand * 1), $iNully - ($iAbstand * 1), $iAbstand * 2, $iAbstand * 2, $Pen1)
    EndIf

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

    GUISetState(@SW_DISABLE, $hSettings)
    Sleep(1000)
    ;###Netz erstellen Ende
    For $i = 0 To _GUICtrlListView_GetItemCount($cObjektlist) - 1
    Local $sY = _GUICtrlListView_GetItemTextString($cObjektlist, $i)
    Local $aSplitted = StringSplit($sY, "|")
    If $aSplitted[1] = "Function" Then
    draw($aSplitted[2], $aSplitted[3])
    Else
    Local $aSplitted2 = StringSplit($aSplitted[2], "/")
    $aSplitted2[1] = StringReplace($aSplitted2[1], "(", "")
    $aSplitted2[2] = StringReplace($aSplitted2[2], ")", "")
    drawX(Round(($aSplitted2[1] * $iAbstand) + $iNullx), Round((($aSplitted2[2] * (-1)) * $iAbstand) + $iNully))
    EndIf
    Next
    GUISetState(@SW_ENABLE, $hSettings)
    ToolTip("Done!")
    Sleep(2000)
    ToolTip("")
    EndFunc ;==>generate

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

    Func draw($sFunktion, $sColor)
    Local $Brush1 = _GDIPlus_BrushCreateSolid($sColor)
    $sFunktion = StringReplace($sFunktion, "x", "($i / $iAbstand)")
    ToolTip(StringReplace(StringReplace($sFunktion, "$i", "x"), " / xAbstand", ""))
    Sleep(2000)
    For $i = -(@DesktopWidth / 2) To @DesktopWidth / 2
    ToolTip("i = " & $i & "; X = " & Round(Calcxtocoords($i)) & "; Y = " & Round(calcytocoords(Execute($sFunktion))) & "; Funktionswert = " & Execute($sFunktion))
    _GDIPlus_GraphicsFillEllipse($hGraphics, Round(Calcxtocoords($i) - ($iLineWidth / 2)), Round(calcytocoords(Execute($sFunktion) * ($iAbstand)) - ($iLineWidth / 2)), $iLineWidth, $iLineWidth, $Brush1)
    Next
    $bDrawed = True
    EndFunc ;==>draw

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

    Func drawX($iMousePosx = -1, $iMousePosy = -1)
    If $bDrawed = False Then Return
    If $iMousePosx = -1 And $iMousePosy = -1 Then
    If WinGetState($sTitle2, "") = 8 Then Return
    If _MousePosCheck() = 1 Then Return
    Local $aPos = MouseGetPos()
    $iMousePosx = $aPos[0]
    $iMousePosy = $aPos[1]
    _GDIPlus_GraphicsDrawLine($hGraphics, $aPos[0] - 7, $aPos[1] - 7, $aPos[0] + 7, $aPos[1] + 7, $Pen3)
    _GDIPlus_GraphicsDrawLine($hGraphics, $aPos[0] + 7, $aPos[1] - 7, $aPos[0] - 7, $aPos[1] + 7, $Pen3)
    GUICtrlCreateListViewItem("Mark|(" & Round(($aPos[0] - $iNullx) / $iAbstand, 2) & "/" & Round(calcytocoords($aPos[1]) / $iAbstand, 2) & ")|" & $sXColor, $cObjektlist)
    Else
    _GDIPlus_GraphicsDrawLine($hGraphics, $iMousePosx - 7, $iMousePosy - 7, $iMousePosx + 7, $iMousePosy + 7, $Pen3)
    _GDIPlus_GraphicsDrawLine($hGraphics, $iMousePosx + 7, $iMousePosy - 7, $iMousePosx - 7, $iMousePosy + 7, $Pen3)
    EndIf
    EndFunc ;==>drawX

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

    Func addfunc()
    $bDrawed = False
    Do
    Local $sInputFunktion = InputBox("Function", "Enter a function, please!" & @CRLF & "Use x for the variable!" & @CRLF & "Y=", Default, Default, Default, Default, Default, Default, $hGui)
    Until $sInputFunktion <> "" Or @error
    If @error Then Return
    Do
    Local $sColor = _ChooseColor(2, 0x990000, Default, $hGui)
    Until $sColor <> -1 Or @error
    If @error Then Return
    Local $sColor2 = StringReplace($sColor, "0x", "0xFF")
    GUICtrlSetBkColor(GUICtrlCreateListViewItem("Function|" & $sInputFunktion & "|" & $sColor2, $cObjektlist), $sColor)
    EndFunc ;==>addfunc

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

    Func _MousePosCheck()
    Local $aPos = WinGetPos($sTitle2)
    $x_check = $aPos[0]
    $y_check = $aPos[1]
    $x_size = $aPos[2]
    $y_size = $aPos[3]

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

    If MouseGetPos(0) >= $x_check And MouseGetPos(0) <= $x_check + $x_size And MouseGetPos(1) >= $y_check And MouseGetPos(1) <= $y_check + $y_size Then
    Return (1)
    Else
    Return (0)
    EndIf
    EndFunc ;==>_MousePosCheck

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

    Func deletefunc()
    _GUICtrlListView_DeleteItemsSelected($cObjektlist)
    EndFunc ;==>deletefunc

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

    Func setbk()
    $sBackgroundcolor = _ChooseColor(2, 0x000000)
    GUICtrlSetBkColor($cButtonBk, $sBackgroundcolor)
    EndFunc ;==>setbk

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

    Func setmark()
    $sXColor = StringReplace(_ChooseColor(2, 0x000000), "0x", "0xFF")
    GUICtrlSetBkColor($cButtonMark, $sXColor)
    EndFunc ;==>setmark

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

    Func setgrid()
    $sGridColor = StringReplace(_ChooseColor(2, 0x000000), "0x", "0xFF")
    GUICtrlSetBkColor($cButtonGrid, $sGridColor)
    EndFunc ;==>setgrid

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

    Func setsystem()
    $sCoordfarbe = StringReplace(_ChooseColor(2, 0x000000), "0x", "0xFF")
    GUICtrlSetBkColor($cButtonSystem, $sCoordfarbe)
    EndFunc ;==>setsystem

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

    Func calcxtocoords($iX)
    Return $iX + $iNullx
    EndFunc ;==>calcxtocoords

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

    Func calcytocoords($iY)
    Return (-$iY + $iNully)
    EndFunc ;==>calcytocoords

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

    Func ende()
    _GDIPlus_PenDispose($Pen1)
    _GDIPlus_PenDispose($Pen2)
    _GDIPlus_PenDispose($Pen3)
    _GDIPlus_BrushDispose($Brush1)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>ende

    [/autoit]

    Einmal editiert, zuletzt von stayawayknight (18. November 2010 um 16:48)

  • Hey,

    schönes Script :]!
    Allerdings würd ich den Vollbildmodus weg lassen.. ich mag das nicht so..wahrscheinlich Gewöhnungssache ;]
    Was vielleicht auch nicht schlecht wäre, wäre eine Inputbox in der man die Funktionsgleichung eingeben kann.. oder irgendwelche Koordinaten..

    LG n3v

  • hallo stayawayknight,
    ich muss n3v zustimmen. Ein tolles Script :thumbup: . Ich finde auch den Vollbildmodus ok. Um n3v gerecht zu werden, kannst du ja am einfach eine MsgBox machen, wo man mit Ja oder Nein den Vollbildschirm wählen kann. Also dass man mit dem Cursor punkte wählen kann (quasi wie ein Zeichenprogramm) und dann da so kleine Xse als makierung wären, wär nicht schlecht. Inputbox könnte man dann vllt auch noch einbauen, ist für mich aber eher nicht so wichtig - hängt aber auch davon ab, ob du das Script mehr als UDF oder als kleines Zeichenprogramm "anbieten" willst.

    Ja ansonsten, jo.. das was ich gesehen hab gefällt mir ganz gut ;D
    hab noch keinen Blick übers Script geworfen und mir nur mal deine Beispieleinstellungen reingezogen, scheint soweit aber kein ("schwerwiegender" bzw auffälliger) Bug vorzuliegen.

    mfG
    Developer30

    "Je mehr Käse, desto mehr Löcher; je mehr Löcher, desto weniger Käse. Ergo: Je mehr Käse, desto weniger Käse. 8| "
    "Programmers never die: they just GOSUB without RETURN"
    "I tried to change the world but I couldn't find the source code."

  • Danke für euer nettes Feedback!
    Wollte nur wissen, ob ihr das gut findet, so bau ich jetzt etwas größeres draus!
    Sind u. a. meine ersten Versuche mi GDI+, daher auch als Übung gedacht.

    Vollbildmodus werde ich aber erstmal lassen, ist am praktischsten

    Einmal editiert, zuletzt von stayawayknight (16. November 2010 um 18:22)

  • also bei mir nicht. weder unter x86 noch x64..

    "Je mehr Käse, desto mehr Löcher; je mehr Löcher, desto weniger Käse. Ergo: Je mehr Käse, desto weniger Käse. 8| "
    "Programmers never die: they just GOSUB without RETURN"
    "I tried to change the world but I couldn't find the source code."

  • sieht schon viel besser aus :thumbup:
    gefällt mir gut. Ich verstehe das mit der Funktion bloß nicht ganz.. kannst du mal kurz mögliche Funktionen auflisten?

    mfG
    Developer30

    "Je mehr Käse, desto mehr Löcher; je mehr Löcher, desto weniger Käse. Ergo: Je mehr Käse, desto weniger Käse. 8| "
    "Programmers never die: they just GOSUB without RETURN"
    "I tried to change the world but I couldn't find the source code."

  • schööön :D

    fehlt nur noch das man das Fenster kleiner machen kann und kein Vollbildmodus mehr ist :>

    das wäre einfach prakticher wenn man damit arbeitet :D


    edit//
    Vielleicht kannste noch ne Funktion mit rein bringen die Anzeigt wo sich welche Funktionen schneiden... ;]
    und was auch noch nützlich wäre, wäre wenn das Koordinatensystem beschriftet wäre :D


    LG 2111 / n3v

    Einmal editiert, zuletzt von n3v (18. November 2010 um 19:53)

  • Also ich hab mir das angeschaut und muss sagen: TOP! :thumbup:

    Da wir gerade Funktionen in Mathe durchnehmen (zum wiederholten Male :thumbdown: ) ist das Programm genau das richtige für mich! :thumbup:

    Was auch noch intressant wäre:
    Nullstellenberechnung
    Extremwertberechnung
    Schnittpunktberechnung

    MfG,
    H2112.

    Zitat

    [Heute, 11:39] Raupi: Soll ich es dir machen?
    [Heute, 11:47] BugFix: "Soll ich es dir machen? " - also Raupi !! bitte nicht so öffentlich :rofl:

    Zitat

    [Heute, 11:51] BugFix: und ich werde es mir jetzt machen - das Mittagessen :P

    AMsg UDF v1.00.00 IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII 100%
    OwnStyle UDF Version 1.10.00 IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII 100%

  • Danke für euer Feedback! Ich werde versuchen, eure Verbesserungsvorschläge umzusetzen!
    Mal schauen, ob ich aus dem Vollbildmodus rauskomm, hab alles drauf ausgerichtet...
    Habs auch gemacht um Redraw-Funktionen zu sparen.

  • hey leute ich habs hier mal in nem Fenster gemacht :D

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <SliderConstants.au3>
    #include <GuiSlider.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <Misc.au3>
    #include <GDIPlus.au3>
    #include <SliderConstants.au3>
    #include <GuiListView.au3>
    #include <Array.au3>
    ;###User Options Start
    $sCoordfarbe = "0xFF800000" ;Gitterfarbe in ARGB
    $sGridColor = "0xFF99FFFF" ;Koordinatensystemfarbe in ARGB
    $sBackgroundcolor = "0x000000" ;Hintergrundfarbe in RGB
    $sXColor = "0xFFFFFFFF" ;Farbe der X, die beim Klicken erscheinen in ARGB
    $iLineWidth = 6 ;Graphenlinienbreite
    ;###User Options Ende

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

    ;###Options Start
    Opt("GuiOnEventMode", 1)
    HotKeySet("{ESC}", "ende")
    OnAutoItExitRegister("ende")
    Const $iNullx = Round((@DesktopWidth - 200) / 2)
    Const $iNully = Round((@DesktopHeight - 200) / 2)
    $sTitle = "Funktionsgraph"
    $sTitle2 = "Einstellungsmenü"
    $bDrawed = False
    ;###Options Ende
    ;###Gui Start
    $hGui = GUICreate($sTitle, @DesktopWidth - 200, @DesktopHeight - 200, 100, 100)
    GUISetBkColor($sBackgroundcolor, $hGui)
    GUISetState(@SW_SHOW, $hGui)
    ;Neue Gui:
    $hSettings = GUICreate($sTitle2, 350, 280, @DesktopWidth - 350, @DesktopHeight - 280, BitOR($WS_CAPTION, $WS_GROUP), $WS_EX_TOPMOST, $hGui)
    GUISetBkColor(0xFFFFFF, $hSettings)
    $cMousePos = GUICtrlCreateLabel("MousePos:", 0, 0, 300, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
    $cCGrid = GUICtrlCreateCheckbox("Grid", 0, 25, 50, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
    GUICtrlSetState(-1, $GUI_CHECKED)
    $cCUnitCircle = GUICtrlCreateCheckbox("Unit Circle", 52, 25, 85, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
    $cCScale = GUICtrlCreateCheckbox("Scale", 140, 25, 60, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
    GUICtrlSetState(-1, $GUI_CHECKED)
    GUICtrlCreateButton("Generate", 202, 25, 80, 20)
    GUICtrlSetOnEvent(-1, "generate")
    GUICtrlCreateButton("Add function", 0, 60, 90, 20)
    GUICtrlSetOnEvent(-1, "addfunc")
    GUICtrlCreateButton("Delete function", 95, 60, 100, 20)
    GUICtrlSetOnEvent(-1, "deletefunc")
    GUICtrlCreateButton("Quit", 200, 60, 100, 20)
    GUICtrlSetOnEvent(-1, "ende")
    $cObjektlist = GUICtrlCreateListView("Objekttyp |Wert |Farbe ", 0, 82, 300, 140)
    $cZoom = GUICtrlCreateSlider(310, 55, 25, 165, $TBS_VERT)
    GUICtrlSetLimit(-1, 200, 1)
    GUICtrlSetData($cZoom, 20)
    $cZoomlabel = GUICtrlCreateLabel("Zoom:" & @CRLF & GUICtrlRead($cZoom), 296, 0, 40, 60)
    GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
    For $i = 10 To 200 Step 10
    _GUICtrlSlider_SetTic($cZoom, $i)
    Next
    $cButtonBk = GUICtrlCreateButton("Background", 0, 230, 60, 20)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, $sBackgroundcolor)
    GUICtrlSetOnEvent(-1, "setbk")
    $cButtonSystem = GUICtrlCreateButton("System", 65, 230, 40, 20)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, StringReplace($sCoordfarbe, "0xFF", "0x"))
    GUICtrlSetOnEvent(-1, "setsystem")
    $cButtonGrid = GUICtrlCreateButton("Grid", 110, 230, 30, 20)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, StringReplace($sGridColor, "0xFF", "0x"))
    GUICtrlSetOnEvent(-1, "setgrid")
    $cButtonMark = GUICtrlCreateButton("Mark", 145, 230, 30, 20)
    GUICtrlSetColor(-1, 0x000000)
    GUICtrlSetBkColor(-1, StringReplace($sXColor, "0xFF", "0x"))
    GUICtrlSetOnEvent(-1, "setmark")
    ControlFocus($sTitle2, "", $cObjektlist)
    GUISetState(@SW_SHOW, $hSettings)
    ;###Gui Ende
    ;###GDIPlus Start
    _GDIPlus_Startup()
    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
    $Pen2 = _GDIPlus_PenCreate($sGridColor, 1)
    $Pen1 = _GDIPlus_PenCreate($sCoordfarbe, 1)
    $Pen3 = _GDIPlus_PenCreate($sXColor, 1)
    $Brush1 = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    ;###GDIPlus Ende
    While 1
    $aPos = GUIGetCursorInfo($hGui)
    $iZoom = GUICtrlRead($cZoom) ;Zoom
    $iAbstand = Round((@DesktopHeight-200) / $iZoom)
    GUICtrlSetData($cMousePos, "Mousepos: (" & Round(($aPos[0] - $iNullx) / $iAbstand, 2) & "|" & Round(calcytocoords($aPos[1]) / $iAbstand, 2) & ")")
    If _IsPressed(01) Then
    drawX()
    Do
    Until Not _IsPressed(01)
    EndIf
    GUICtrlSetData($cZoomlabel, "Zoom:" & @CRLF & GUICtrlRead($cZoom))
    Sleep(100)
    WEnd
    ende()

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

    Func generate()
    GUISetBkColor($sBackgroundcolor, $hGui)
    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
    If GUICtrlRead($cCGrid) = $GUI_CHECKED Then
    $bGrid = True
    Else
    $bGrid = False
    EndIf
    If GUICtrlRead($cCScale) = $GUI_CHECKED Then
    $bScale = True
    Else
    $bScale = False
    EndIf
    If GUICtrlRead($cCUnitCircle) = $GUI_CHECKED Then
    $bEinheitskreis = True
    Else
    $bEinheitskreis = False
    EndIf
    ;###Netz erstellen Start
    For $i = 1 To (@DesktopWidth - 200) / $iAbstand ;Beschriftung
    If $bGrid = True Then
    _GDIPlus_GraphicsDrawLine($hGraphics, $iNullx + $iAbstand * $i, 0, $iNullx + $iAbstand * $i, (@DesktopHeight - 200), $Pen2) ;x rechts
    _GDIPlus_GraphicsDrawLine($hGraphics, 0, $iNully - $iAbstand * $i, (@DesktopWidth - 200), $iNully - $iAbstand * $i, $Pen2);y oben
    _GDIPlus_GraphicsDrawLine($hGraphics, 0, $iNully + $iAbstand * $i, (@DesktopWidth - 200), $iNully + $iAbstand * $i, $Pen2);y unten
    _GDIPlus_GraphicsDrawLine($hGraphics, $iNullx - $iAbstand * $i, 0, $iNullx - $iAbstand * $i, (@DesktopWidth - 200), $Pen2);x links
    EndIf
    If $bScale = True Then
    _GDIPlus_GraphicsDrawLine($hGraphics, $iNullx + $iAbstand * $i, $iNully - 10, $iNullx + $iAbstand * $i, $iNully + 10, $Pen1) ;x rechts
    _GDIPlus_GraphicsDrawLine($hGraphics, $iNullx - 10, $iNully - $iAbstand * $i, $iNullx + 10, $iNully - $iAbstand * $i, $Pen1);y oben
    _GDIPlus_GraphicsDrawLine($hGraphics, $iNullx - 10, $iNully + $iAbstand * $i, $iNullx + 10, $iNully + $iAbstand * $i, $Pen1);y unten
    _GDIPlus_GraphicsDrawLine($hGraphics, $iNullx - $iAbstand * $i, $iNully - 10, $iNullx - $iAbstand * $i, $iNully + 10, $Pen1);x links
    EndIf
    Next
    _GDIPlus_GraphicsDrawLine($hGraphics, 0, $iNully, (@DesktopWidth - 200), $iNully, $Pen1) ;x-Achse
    _GDIPlus_GraphicsDrawLine($hGraphics, $iNullx, 0, $iNullx, (@DesktopHeight - 200), $Pen1);y-Achse
    If $bEinheitskreis = True Then
    _GDIPlus_GraphicsDrawEllipse($hGraphics, $iNullx - ($iAbstand * 1), $iNully - ($iAbstand * 1), $iAbstand * 2, $iAbstand * 2, $Pen1)
    EndIf

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

    GUISetState(@SW_DISABLE, $hSettings)
    Sleep(1000)
    ;###Netz erstellen Ende
    For $i = 0 To _GUICtrlListView_GetItemCount($cObjektlist) - 1
    Local $sY = _GUICtrlListView_GetItemTextString($cObjektlist, $i)
    Local $aSplitted = StringSplit($sY, "|")
    If $aSplitted[1] = "Function" Then
    draw($aSplitted[2], $aSplitted[3])
    Else
    Local $aSplitted2 = StringSplit($aSplitted[2], "/")
    $aSplitted2[1] = StringReplace($aSplitted2[1], "(", "")
    $aSplitted2[2] = StringReplace($aSplitted2[2], ")", "")
    drawX(Round(($aSplitted2[1] * $iAbstand) + $iNullx), Round((($aSplitted2[2] * (-1)) * $iAbstand) + $iNully))
    EndIf
    Next
    GUISetState(@SW_ENABLE, $hSettings)
    ToolTip("Done!")
    Sleep(2000)
    ToolTip("")
    EndFunc ;==>generate

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

    Func draw($sFunktion, $sColor)
    Local $Brush1 = _GDIPlus_BrushCreateSolid($sColor)
    $sFunktion = StringReplace($sFunktion, "x", "($i / $iAbstand)")
    ToolTip(StringReplace(StringReplace($sFunktion, "$i", "x"), " / xAbstand", ""))
    Sleep(2000)
    For $i = -((@DesktopWidth - 200) / 2) To (@DesktopWidth -200) / 2
    ToolTip("i = " & $i & "; X = " & Round(Calcxtocoords($i)) & "; Y = " & Round(calcytocoords(Execute($sFunktion))) & "; Funktionswert = " & Execute($sFunktion))
    _GDIPlus_GraphicsFillEllipse($hGraphics, Round(Calcxtocoords($i) - ($iLineWidth / 2)), Round(calcytocoords(Execute($sFunktion) * ($iAbstand)) - ($iLineWidth / 2)), $iLineWidth, $iLineWidth, $Brush1)
    Next
    $bDrawed = True
    EndFunc ;==>draw
    Func drawX($iMousePosx = -1, $iMousePosy = -1)
    If $bDrawed = False Then Return
    If $iMousePosx = -1 And $iMousePosy = -1 Then
    If WinGetState($sTitle2, "") = 8 Then Return
    If _MousePosCheck() = 1 Then Return
    Local $aPos = GUIGetCursorInfo($hGui)
    $iMousePosx = $aPos[0]
    $iMousePosy = $aPos[1]
    _GDIPlus_GraphicsDrawLine($hGraphics, $aPos[0] - 7, $aPos[1] - 7, $aPos[0] + 7, $aPos[1] + 7, $Pen3)
    _GDIPlus_GraphicsDrawLine($hGraphics, $aPos[0] + 7, $aPos[1] - 7, $aPos[0] - 7, $aPos[1] + 7, $Pen3)
    GUICtrlCreateListViewItem("Mark|(" & Round(($aPos[0] - $iNullx) / $iAbstand, 2) & "/" & Round(calcytocoords($aPos[1]) / $iAbstand, 2) & ")|" & $sXColor, $cObjektlist)
    Else
    _GDIPlus_GraphicsDrawLine($hGraphics, $iMousePosx - 7, $iMousePosy - 7, $iMousePosx + 7, $iMousePosy + 7, $Pen3)
    _GDIPlus_GraphicsDrawLine($hGraphics, $iMousePosx + 7, $iMousePosy - 7, $iMousePosx - 7, $iMousePosy + 7, $Pen3)
    EndIf
    EndFunc ;==>drawX

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

    Func addfunc()
    $bDrawed = False
    Do
    Local $sInputFunktion = InputBox("Function", "Enter a function, please!" & @CRLF & "Use x for the variable!" & @CRLF & "Y=", Default, Default, Default, Default, Default, Default, $hGui)
    Until $sInputFunktion <> "" Or @error
    If @error Then Return
    Do
    Local $sColor = _ChooseColor(2, 0x990000, Default, $hGui)
    Until $sColor <> -1 Or @error
    If @error Then Return
    Local $sColor2 = StringReplace($sColor, "0x", "0xFF")
    GUICtrlSetBkColor(GUICtrlCreateListViewItem("Function|" & $sInputFunktion & "|" & $sColor2, $cObjektlist), $sColor)
    EndFunc ;==>addfunc

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

    Func _MousePosCheck()
    Local $aPos = WinGetPos($sTitle2)
    $x_check = $aPos[0]
    $y_check = $aPos[1]
    $x_size = $aPos[2]
    $y_size = $aPos[3]
    If MouseGetPos(0) >= $x_check And MouseGetPos(0) <= $x_check + $x_size And MouseGetPos(1) >= $y_check And MouseGetPos(1) <= $y_check + $y_size Then
    Return (1)
    Else
    Return (0)
    EndIf
    EndFunc ;==>_MousePosCheck

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

    Func deletefunc()
    _GUICtrlListView_DeleteItemsSelected($cObjektlist)
    EndFunc ;==>deletefunc
    Func setbk()
    $sBackgroundcolor = _ChooseColor(2, 0x000000)
    GUICtrlSetBkColor($cButtonBk, $sBackgroundcolor)
    EndFunc ;==>setbk
    Func setmark()
    $sXColor = StringReplace(_ChooseColor(2, 0x000000), "0x", "0xFF")
    GUICtrlSetBkColor($cButtonMark, $sXColor)
    EndFunc ;==>setmark
    Func setgrid()
    $sGridColor = StringReplace(_ChooseColor(2, 0x000000), "0x", "0xFF")
    GUICtrlSetBkColor($cButtonGrid, $sGridColor)
    EndFunc ;==>setgrid
    Func setsystem()
    $sCoordfarbe = StringReplace(_ChooseColor(2, 0x000000), "0x", "0xFF")
    GUICtrlSetBkColor($cButtonSystem, $sCoordfarbe)
    EndFunc ;==>setsystem

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

    Func calcxtocoords($iX)
    Return $iX + $iNullx
    EndFunc ;==>calcxtocoords

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

    Func calcytocoords($iY)
    Return (-$iY + $iNully)
    EndFunc ;==>calcytocoords

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

    Func ende()
    _GDIPlus_PenDispose($Pen1)
    _GDIPlus_PenDispose($Pen2)
    _GDIPlus_PenDispose($Pen3)
    _GDIPlus_BrushDispose($Brush1)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>ende

    [/autoit]