1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. SEuBo

Beiträge von SEuBo

  • Dreieck / Kreis berechnen

    • SEuBo
    • 12. März 2010 um 18:37

    ich habs verstanden :O
    Danke vielmals an alle !

    Der Post von UEZ hat endlich dafür gesorgt, dass es Klick macht! Danke dafür.

    Ich hab mal das was ich da gelernt habe versucht umzusetzen. Rausgekommen ist dabei dann folgendes:

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GDIPlus.au3>
    Opt("GUIOnEventMode", 1)
    OnAutoItExitRegister("__GDIPlus_Shutdown")
    _GDIPlus_Startup()

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

    Global $iRadius = 100
    Global $iWidth = 640, $iHeight = 480
    $GUI_Back_Color = 0xFF000000

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

    Dim $aPoly_k[4][2] = [[3]], $aPoly_g[4][2] = [[3]]
    Dim $aM[2] = [$iWidth / 2, $iHeight / 2]
    $hGUI = GUICreate("", $iWidth, $iHeight)
    GUISetOnEvent(-3, "OnEvent_Eventhandler")
    GUIRegisterMsg($WM_PAINT, "WM_PAINT")

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

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + $GUI_Back_Color)
    $hPen = _GDIPlus_PenCreate(0xFF000000, 3)
    $hPenW = _GDIPlus_PenCreate(0xFFFFFFFF, 3)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic)
    $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hBackbuffer,2)

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

    GUISetState()
    While 1 * Sleep(10)
    _Draw()
    WEnd

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

    Func OnEvent_Eventhandler()
    Switch @GUI_CtrlId
    Case -3
    Exit
    EndSwitch
    EndFunc ;==>OnEvent_Eventhandler

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

    Func _Draw()
    Local $iStep = 1
    Local $deg2rad = ATan(1) * 4 / 180
    Local $iEllipseCol = 0xFFEA33EE, $iTriangleCol = 0xFF6FE1EE
    $iRad2 = $iRadius * 2

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

    For $i = 0 To 720 Step $iStep
    $aPoly_k[1][0] = $aM[0] + Cos($i * $deg2rad) * $iRadius
    $aPoly_k[1][1] = $aM[1] + Sin($i * $deg2rad) * $iRadius
    $aPoly_k[2][0] = $aM[0] + Cos(($i + 120) * $deg2rad) * $iRadius
    $aPoly_k[2][1] = $aM[1] + Sin(($i + 120) * $deg2rad) * $iRadius
    $aPoly_k[3][0] = $aM[0] + Cos(($i + 240) * $deg2rad) * $iRadius
    $aPoly_k[3][1] = $aM[1] + Sin(($i + 240) * $deg2rad) * $iRadius

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

    $aPoly_g[1][0] = $aM[0] + Cos((360 - $i / 2) * $deg2rad) * $iRad2
    $aPoly_g[1][1] = $aM[1] + Sin((360 - $i / 2) * $deg2rad) * $iRad2
    $aPoly_g[2][0] = $aM[0] + Cos(((360 - $i / 2) + 120) * $deg2rad) * $iRad2
    $aPoly_g[2][1] = $aM[1] + Sin(((360 - $i / 2) + 120) * $deg2rad) * $iRad2
    $aPoly_g[3][0] = $aM[0] + Cos(((360 - $i / 2) + 240) * $deg2rad) * $iRad2
    $aPoly_g[3][1] = $aM[1] + Sin(((360 - $i / 2) + 240) * $deg2rad) * $iRad2

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

    ;~ _ArrayDisplay($aPoly_k)
    ;~ x = Xm + cos(Winkel)*Radius
    _GDIPlus_GraphicsClear($hBackbuffer, $GUI_Back_Color)

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

    _GDIPlus_BrushSetSolidColor($hBrush, $iTriangleCol)
    _GDIPlus_GraphicsFillPolygon($hBackbuffer, $aPoly_g, $hBrush)
    _GDIPlus_GraphicsDrawPolygon($hBackbuffer, $aPoly_g, $hPenW)

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

    _GDIPlus_BrushSetSolidColor($hBrush, 0xFFEBCC8B)
    _GDIPlus_GraphicsFillEllipse($hBackbuffer, $aM[0] - $iRadius, $aM[1] - $iRadius, $iRadius * 2, $iRadius * 2, $hBrush)
    _GDIPlus_GraphicsDrawEllipse($hBackbuffer, $aM[0] - $iRadius, $aM[1] - $iRadius, $iRadius * 2, $iRadius * 2, $hPen)

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

    _GDIPlus_BrushSetSolidColor($hBrush, 0x55F59C9C)
    _GDIPlus_GraphicsFillPolygon($hBackbuffer, $aPoly_k, $hBrush)
    _GDIPlus_GraphicsDrawPolygon($hBackbuffer, $aPoly_k, $hPen)

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

    _GDIPlus_BrushSetSolidColor($hBrush, 0x77EA33EE)
    _GDIPlus_GraphicsFillEllipse($hBackbuffer, $aM[0] - $iRad2, $aM[1] - $iRad2, $iRad2 * 2, $iRad2 * 2, $hBrush)
    _GDIPlus_GraphicsDrawEllipse($hBackbuffer, $aM[0] - $iRad2, $aM[1] - $iRad2, $iRad2 * 2, $iRad2 * 2, $hPenW)

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

    WM_PAINT()
    Next
    EndFunc ;==>_Draw

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

    Func WM_PAINT()
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iWidth, $iHeight)
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_PAINT

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

    Func __GDIPlus_Shutdown()
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_Shutdown()
    EndFunc ;==>__GDIPlus_Shutdown

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

    Sehr cool 8)

    //EDIT nochmal angepasst

  • Dreieck / Kreis berechnen

    • SEuBo
    • 12. März 2010 um 15:00

    Soo ich hab jetzt mal ein bisschen gebastelt, aber besser als so bekomme ichs nciht hin.
    Das sieht aber noch nicht ganz richtig aus. Berechnet wird in den Zeilen 43 ff.

    Ich hab wahrscheinlich alles was ich gelesen hab wild zusammengewürfelt :D
    Kann mir einer sagen, was ich falsch mache?

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GDIPlus.au3>
    Opt("GUIOnEventMode", 1)
    OnAutoItExitRegister("__GDIPlus_Shutdown")
    _GDIPlus_Startup()

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

    Global $iRadius = 100
    Global $iWidth = 640, $iHeight = 480
    $GUI_Back_Color = 0xFF000000

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

    Global $aPolygon

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

    $hGUI = GUICreate("", $iWidth, $iHeight)
    GUISetOnEvent(-3, "OnEvent_Eventhandler")
    GUIRegisterMsg($WM_PAINT, "WM_PAINT")

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

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + $GUI_Back_Color)
    $hPen = _GDIPlus_PenCreate(0xFF000000, 3)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic)
    $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)

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

    _Draw()
    GUISetState()
    While 1 * Sleep(10)
    WEnd

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

    Func OnEvent_Eventhandler()
    Switch @GUI_CtrlId
    Case -3
    Exit
    EndSwitch
    EndFunc ;==>OnEvent_Eventhandler

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

    Func _Draw()
    Local $iPi = 3.14159265358979, $iDegToRad = $iPi / 180
    Local $iEllipseCol = 0xFFEA33EE, $iTriangleCol = 0xFF6FE1EE
    Dim $aMitte[2] = [$iWidth / 2, $iHeight / 2]
    Dim $aPolygon[4][2] = [[3],[$aMitte[0], $aMitte[1] - $iRadius]] ; punkt A, über Mittelpunkt.

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

    $aPolygon[2][0] = $aMitte[0] + Cos($iPi * 1 / 3) * $iRadius
    $aPolygon[2][1] = $aMitte[1] + Sin($iPi * 1 / 3) * $iRadius
    $aPolygon[3][0] = $aMitte[0] + Cos($iPi * 2 / 3) * $iRadius
    $aPolygon[3][1] = $aMitte[1] + Sin($iPi * 2 / 3) * $iRadius
    ;~ _ArrayDisplay($aPolygon)
    ;~ x = Xm + cos(Winkel)*Radius
    _GDIPlus_GraphicsClear($hBackbuffer,$GUI_Back_Color)
    _GDIPlus_PenSetColor($hPen, $iEllipseCol)
    _GDIPlus_GraphicsDrawEllipse($hBackbuffer, $aMitte[0] - $iRadius, $aMitte[1] - $iRadius, $iRadius * 2, $iRadius * 2, $hPen)
    _GDIPlus_PenSetColor($hPen, $iTriangleCol)
    _GDIPlus_GraphicsDrawPolygon($hBackbuffer, $aPolygon,$hPen)
    EndFunc ;==>_Draw

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

    Func WM_PAINT()
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iWidth, $iHeight)
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_PAINT

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

    Func __GDIPlus_Shutdown()
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_Shutdown()
    EndFunc ;==>__GDIPlus_Shutdown

    [/autoit]
  • Dreieck / Kreis berechnen

    • SEuBo
    • 12. März 2010 um 12:07

    Also erstmal danke für die ganzen Antworten. Ich muss mich da mal in Ruhe durchlesen.
    AspirinJunkie: Der Link zu dem Sinus / Cosinus Flash hat auf jeden Fall schonmal geholfen - ich werd da gleich mal rumprobieren.

    Zum Thema: Die Ausrichtung des Dreiecks ist eigentlich egal - das Dreieck wird später eh gedreht. Das ganze soll eigentlich so ablaufen:
    Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist.
    Anhand des Kreisradius wird dasgleichseitige / symmetrische / gleichschenklige / was auch immer Dreieck berechnet. Sagen wir mal der Kreis wäre dabei der Umkreis des Dreiecks. Dann ist der Punkt A in der Skizze schonmal bekannt (100|95)
    Jetzt fehlen noch die anderen 2 Punkte.
    Ich habe aber dank eurer Hilfe schon eine Idee. Ich versuch mal das umzusetzen :)

    Bilder

    • dreieck.jpg
      • 11,02 kB
      • 316 × 266
  • Wert aus .txt in eine Variable speichern

    • SEuBo
    • 12. März 2010 um 02:51

    so?

    [autoit]

    $status = StringLeft(FileRead(@ScriptDir & "\statusinfo.txt"),1)

    [/autoit]
  • Dreieck / Kreis berechnen

    • SEuBo
    • 12. März 2010 um 02:01

    Hallo,

    Nach 9 Jahren Gymi, haben 1 Jahr Haupt- und 1 Jahr Handelsschule wohl das komplette Mathewissen aus meinem Kopf leergeräumt.
    Also folgendes Problem:

    Ich habe einen Kreis mit einem Radius von $r pixeln. Der Mittelpunkt des Kreises ist der Mittelpunkt des GUI's.
    Der Kreis ist gleichzeitig der Innenkreis eines gleichwinkliges ( Gleichseitigen?! ) Dreiecks.

    • Wie berechne ich die einzelnen Punkte auf denen der Kreis gezeichnet wird
    • Wie berechne ich die 3 Eckpunkte des dreiecks, ausgehend vom Radius?

    (Bitte langsam erklären - Dummie am Werk!)

    Danke im Vorraus für eure Hilfe

    PS: Wenn mir noch jemand nen Crashkurs in Berechnungen mit Sinus/Cosinus geben könnt, würd ich sterben vor Glück ^^

  • GDI+ Sinuskurve

    • SEuBo
    • 12. März 2010 um 00:00

    Hat mir echt alles weitergeholfen, danke Prog@ndy.

    Habs jetzt mal abgeändert nachgebaut, und es klappt. Perfekt

    PS: Und nochmal danke für Static. Ich hatte zwar schonmal was drüber gelesen, aber jetzt weiß ich endlich mal was die besonderheit an Static Variablen ist.

    Und die sind ja mal geil praktisch :O

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GDIPlus.au3>
    Opt("GUIOnEventMode", 1)
    OnAutoItExitRegister("__GDIPlus_Shutdown")

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

    Global $iWidth = 400, $iHeight = 200
    $iSteigung = 25

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

    $hGUI = GUICreate("Sonnenuntergang", $iWidth, $iHeight)
    GUISetOnEvent(-3, "OnEvent_Eventhandler")
    GUIRegisterMsg($WM_PAINT, "WM_PAINT")

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

    _GDIPlus_Startup()
    $iGUI_Back_Color = 0xFFF0F0F0
    $iBrushColor = 0xFF61ED6B
    $iPenColor = 0xFF35911E
    $iSkyColor = 0xFFA4F4FB
    Global $aClosedCurve, $aCurve, $aSun

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

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    $hBrush = _GDIPlus_BrushCreateSolid($iBrushColor)
    $hBrushSky = _GDIPlus_BrushCreateSolid($iSkyColor)
    $hYellowBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + 0xFFFF1C)
    $hOrangeBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + 0xFCE074)
    $hPen = _GDIPlus_PenCreate($iPenColor, 3)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic)
    $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)

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

    _Draw()

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

    GUISetState()
    While 1 * Sleep(10)
    _MoveGround()
    WEnd

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

    Func OnEvent_Eventhandler()
    Switch @GUI_CtrlId
    Case -3
    Exit
    EndSwitch
    EndFunc ;==>OnEvent_Eventhandler

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

    Func _MoveGround()
    Local $iStep = 2
    Local Static $iIndex = $iWidth
    Local $iDegToRad = 3.14159265358979 / 180
    ;~ _GDIPlus_GraphicsClear($hBackbuffer, 0xFF000000 + $GUI_Back_Color)
    For $i = 1 To $iWidth - $iStep
    $aClosedCurve[$i + 1][1] = $aClosedCurve[$i + 1 + $iStep][1]
    $aCurve[$i][1] = $aClosedCurve[$i + $iStep][1]
    Next
    For $i = 1 To $iStep
    $iIndex += 1
    If $iIndex >= $iWidth * 1.125 Then $iIndex = $iWidth

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

    ;Steigung berechnen
    $iSteigung = Random($iSteigung - 5, $iSteigung + 5, 1)
    If $iSteigung <= 10 Then $iSteigung = 25
    If $iSteigung >= 60 Then $iSteigung = 30
    ;~ ConsoleWrite($iSteigung & @CRLF)
    ;~ ConsoleWrite($iIndex & @CRLF)

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

    $aCurve[$iWidth - $iStep + $i][1] = ($iHeight * 0.5) + (Sin($iIndex * $iDegToRad) * $iSteigung)
    $aClosedCurve[$iWidth + 1 - $iStep + $i][1] = $aCurve[$iWidth - $iStep + $i][1]
    Next
    ;~ _ArrayDisplay($aClosedCurve)

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

    _GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2)
    _GDIPlus_GraphicsClear($hBackbuffer, $iSkyColor)

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

    _MoveSonne()

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

    _GDIPlus_GraphicsFillClosedCurve($hBackbuffer, $aClosedCurve, $hBrush)
    _GDIPlus_GraphicsDrawCurve($hBackbuffer, $aCurve, $hPen)

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

    _Dunkel()
    _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_INTERNALPAINT)
    EndFunc ;==>_MoveGround

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

    Func _MoveSonne()
    Local Static $iCalls = 0
    Local $iStepX = 0.5, $iStepY = 1
    $iCalls += 1
    If $iCalls = 2 Then
    $aSun[0][0] += $iStepX
    $aSun[0][1] += $iStepY
    $aSun[1][0] += $iStepX
    $aSun[1][1] += $iStepY
    $iCalls = 0
    EndIf

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

    ;~ ConsoleWrite($iCalls & @CRLF)
    _GDIPlus_GraphicsFillEllipse($hBackbuffer, $aSun[0][0], $aSun[0][1], 110, 110, $hOrangeBrush) ; Sonne malen
    _GDIPlus_GraphicsFillEllipse($hBackbuffer, $aSun[1][0], $aSun[1][1], 100, 100, $hYellowBrush)
    EndFunc ;==>_MoveSonne

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

    Func _Dunkel()
    Local Static $iDark = 0x00000000, $iCalls = 0
    $iCalls += 1
    If $iCalls = 3 Then
    Local $iCurrent = $iDark
    If $iCurrent < 2500000000 Then
    $iDark += 0x01000000
    ;~ ConsoleWrite($iDark & @CRLF)
    Else
    MsgBox(0,"","Jetzt ist es dunkel! Du solltest schon lange im Bett sein!")
    Exit
    EndIf
    $iCalls = 0
    EndIf

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

    $hDarkBrush = _GDIPlus_BrushCreateSolid($iDark)
    _GDIPlus_GraphicsFillRect($hBackbuffer, 0, 0, $iWidth, $iHeight, $hDarkBrush)
    _GDIPlus_BrushDispose($hDarkBrush)

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

    EndFunc ;==>_Dunkel

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

    Func _Draw()
    Local $iDegToRad = 3.14159265358979 / 180
    Dim $aClosedCurve[$iWidth + 3][2] = [[$iWidth + 2]]
    Dim $aCurve[$iWidth + 1][2] = [[$iWidth]]
    For $i = 1 To $iWidth
    $iSteigung = Random($iSteigung - 5, $iSteigung + 5, 1)
    If $iSteigung <= 10 Then $iSteigung = 25
    If $iSteigung >= 40 Then $iSteigung = 25
    $aClosedCurve[$i + 1][0] = $i
    $aClosedCurve[$i + 1][1] = ($iHeight * 0.5) + (Sin($i * $iDegToRad) * $iSteigung)
    $aCurve[$i][0] = $i
    $aCurve[$i][1] = ($iHeight * 0.5) + (Sin($i * $iDegToRad) * $iSteigung)
    Next
    $aClosedCurve[1][0] = 0
    $aClosedCurve[1][1] = $iHeight
    $aClosedCurve[$iWidth + 2][0] = $iWidth
    $aClosedCurve[$iWidth + 2][1] = $iHeight

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

    _GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2)
    _GDIPlus_GraphicsClear($hBackbuffer, $iSkyColor)

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

    Dim $aSun[2][5] = [[5, 5, 110, 110, True],[10, 10, 100, 100, True]]
    _GDIPlus_GraphicsFillEllipse($hBackbuffer, 5, 5, 110, 110, $hOrangeBrush) ; Sonne malen
    _GDIPlus_GraphicsFillEllipse($hBackbuffer, 10, 10, 100, 100, $hYellowBrush)

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

    _GDIPlus_GraphicsFillClosedCurve($hBackbuffer, $aClosedCurve, $hBrush)
    _GDIPlus_GraphicsDrawCurve($hBackbuffer, $aCurve, $hPen)

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

    ;~ WM_PAINT()
    EndFunc ;==>_Draw

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

    Func WM_PAINT()
    ;~ _GDIPlus_GraphicsClear($hBackbuffer, $iGUI_Back_Color)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iWidth, $iHeight)
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_PAINT

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

    Func __GDIPlus_Shutdown()
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_Shutdown()
    EndFunc ;==>__GDIPlus_Shutdown

    [/autoit]
  • If Then ... Knopf

    • SEuBo
    • 11. März 2010 um 17:49
    Zitat von SEuBo

    Meinst du das nicht eher so?

    Nee war auf den ersten Post bezogen ^^ wir haben ja fast zeitgleich gepostet.

    Zitat von mauric

    <> "" vergleichen die GUICtrlRead Variablen oder ?

    <> "" ist einfach nur das Gegenteil von = "". Also ungleich (<>) leer ("")

  • If Then ... Knopf

    • SEuBo
    • 11. März 2010 um 17:19

    Meinst du das nicht eher so?

    Spoiler anzeigen
    [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $runnow
    If GUICtrlRead($laptop) <> "" And GUICtrlRead($os) <> "" And GUICtrlRead($office) <> "" And GUICtrlRead($language) <> "" Then
    If FileExists("r:\" & $laptop & $os & $office & $language) Then
    MsgBox(0, "", "file exist")
    _RunNow()
    Else
    MsgBox(0, "", "file does not exist")
    EndIf
    Else
    MsgBox(0, "Hinweis", "Bitte zuerst alle Felder ausfüllen!")
    EndIf
    EndSwitch
    WEnd

    [/autoit]
  • Gui Fenster richtig verkleinern!

    • SEuBo
    • 11. März 2010 um 16:29

    ... oder so könnte es richtig sein (//EDIT: 6 minuten... wow das ist hart.)

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #region ### START Koda GUI section ### Form=
    $Form2 = GUICreate("Form2", 870, 163, 302, 218)
    $Button1 = GUICtrlCreateButton("Button1", 16, 80, 101, 49, $WS_GROUP)
    GUICtrlSetResizing(-1,$GUI_DOCKALL) ; Den Buttons muss gesagt werden, wie sie sich beim Resize verhalten sollen. Dockall = Keine veränderung.
    $Button2 = GUICtrlCreateButton("Button2", 136, 80, 101, 49, $WS_GROUP)
    GUICtrlSetResizing(-1,$GUI_DOCKALL)
    $Button3 = GUICtrlCreateButton("Button3", 268, 80, 101, 49, $WS_GROUP)
    GUICtrlSetResizing(-1,$GUI_DOCKALL)
    $Button4 = GUICtrlCreateButton("Button4", 392, 80, 101, 49, $WS_GROUP)
    GUICtrlSetResizing(-1,$GUI_DOCKALL)

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

    GUISetState(@SW_SHOW)
    #endregion ### END Koda GUI section ###

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

    Func Verkleinern()
    WinMove($Form2, "", default, default, 509, 163) ; default darf nicht als String geschrieben werden!
    EndFunc ;==>Verkleinern

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    Verkleinern()
    EndSwitch
    WEnd

    [/autoit]
  • Richtungswechsel einer Linie

    • SEuBo
    • 11. März 2010 um 16:22

    Meinst du so?

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>

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

    Opt("GUIOnEventMode", 1)

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

    Global $hGui, $width = 600, $height = $width, $i = 100
    Global $fFromLeft = True
    $hGui = GUICreate("GDI+", $width, $height, -1, -1)
    GUISetOnEvent(-3, "_disp")
    GUISetState()

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

    _GDIPlus_Startup()
    Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
    Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $hGraphics)
    Global $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    Global $hPen = _GDIPlus_PenCreate(0xFF990001, 2)

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

    _GDIPlus_GraphicsClear($hBackbuffer)

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

    While 1
    Switch $fFromLeft
    Case True
    $i += 1
    If $i = 300 Then $fFromLeft = False
    Case False
    $i -= 1
    If $i = 100 Then $fFromLeft = True
    EndSwitch

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

    _GDIPlus_GraphicsClear($hBackbuffer)
    _GDIPlus_GraphicsDrawLine($hBackbuffer, $i, 200, 240, 250, $hPen)
    _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)

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

    ToolTip($i)
    WEnd

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

    Func _disp()
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_GraphicsDispose($hBackbuffer)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_PenCreate($hPen)
    _GDIPlus_Shutdown()
    GUIDelete($hGui)
    Exit
    EndFunc ;==>_disp

    [/autoit]
  • GDI+ Sinuskurve

    • SEuBo
    • 11. März 2010 um 15:38

    Danke ich werd mir das mal anschauen

  • GDI+ Hilfe

    • SEuBo
    • 11. März 2010 um 15:38
    Spoiler anzeigen
    [autoit]

    Opt("MouseCoordMode",0) ; oder 2 statt 0 wenn du den client bereich haben willst

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

    While 1 * Sleep(50)
    $aMPos = MouseGetPos()
    $sTitle = WinGetTitle("")
    $sText = $sTitle & @CRLF & $aMPos[0] & @TAB &$aMPos[1]
    ToolTip($sText)
    WEnd

    [/autoit]
  • GDI+ Sinuskurve

    • SEuBo
    • 11. März 2010 um 14:13

    Mit der normalen

    [autoit]

    _GDIPlus_GraphicsDrawClosedCurve

    [/autoit]

    Funktion klappt es ja (fast?!)
    nur sobald ich versuche das ganze zu füllen flackert es stark.
    _GDIPlus_GraphicsSetSmoothingMode hat auf jeden fall schon etwas geholfen.

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GDIPlus.au3>
    Opt("GUIOnEventMode", 1)
    OnAutoItExitRegister("__GDIPlus_Shutdown")
    _GDIPlus_Startup()
    Global $iSpeed = 5

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

    Global $iDegToRad = 3.14159265358979 / 180
    Global $iWidth = 800, $iHeight = 200
    $GUI_Back_Color = 0xF0F0F0

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

    Dim $aLine[43][2] = [[42, ""],[0 - 10, $iHeight + 10]] ; Array mit koordinaten für _GDIPlus_Graphicsdrawcurve
    For $i = 2 To UBound($aLine) - 2
    $aLine[$i][0] = ($i - 1) * 20
    $aLine[$i][1] = $iHeight / 1.5 + Sin(($i - 1) * Random(10, 30, 1) * $iDegToRad) * 100
    Next
    $aLine[42][0] = $iWidth - 10
    $aLine[42][1] = $iHeight + 10

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

    ;~ _ArrayDisplay($aLine)

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

    $hGUI = GUICreate("", $iWidth, $iHeight)
    GUISetOnEvent(-3, "OnEvent_Eventhandler")
    GUIRegisterMsg($WM_PAINT, "WM_PAINT")

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

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + $GUI_Back_Color)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic)
    $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)

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

    GUISetState()
    While 1 * Sleep(10)
    Local $iUbound = UBound($aLine)
    For $i = 2 To $iUbound - 3 ; Alle außer die Eckpunkten ul & ur
    $aLine[$i][0] = $aLine[$i][0] - $iSpeed ; geschwindigkeit von X-Koordinate abziehen (Bewegung links)
    Next

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

    If $aLine[2][0] <= 0 Then ; Wenn erster richtiger punkt X <= 0 hat, dann
    For $i = 2 To $iUbound - 3
    $aLine[$i][1] = $aLine[$i + 1][1] ; Alle punkte im Array eins nach oben schieben,
    $aLine[$i][0] = $aLine[$i + 1][0]
    Next
    $aLine[$iUbound - 2][1] = $iHeight / 1.5 + Sin(($iUbound - 2) * Random(10, 30, 1) * $iDegToRad) * 100 ; Und neue Koordinate einfügen (Sonst ist die bewegung vorbei, wenn 1x alle punkte durch sind)
    EndIf
    ;~ _ArrayDisplay($aLine)
    WM_PAINT()
    WEnd

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

    Func OnEvent_Eventhandler()
    Switch @GUI_CtrlId
    Case -3
    Exit
    EndSwitch
    EndFunc ;==>OnEvent_Eventhandler

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

    Func WM_PAINT()
    _GDIPlus_GraphicsClear($hBackbuffer, 0xFF000000 + $GUI_Back_Color)
    ;~ _GDIPlus_GraphicsDrawClosedCurve($hBackbuffer, $aLine)
    _GDIPlus_GraphicsFillClosedCurve($hBackbuffer, $aLine)
    _GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iWidth, $iHeight)
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_PAINT

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

    Func __GDIPlus_Shutdown()
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_Shutdown()
    EndFunc ;==>__GDIPlus_Shutdown

    [/autoit]

    Hintergrund des ganzen war eigentlich, dass ich das hier besser hinbekomme (das ist ziemlich zusammengeschustert, und sieht mehr lustig als cool aus. Aber ich bin Anfänger - ich darf das :D)

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GDIPlus.au3>
    Opt("GUIOnEventMode", 1)
    OnAutoItExitRegister("__GDIPlus_Shutdown")
    _GDIPlus_Startup()

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

    Global $iWidth = 600, $iHeight = 300
    $iWidth = 50 * Floor($iWidth / 50)
    $iHeight = 50 * Floor($iHeight / 50)
    $GUI_Back_Color = 0x7BEAFD

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

    $iLast = 175
    Dim $aLine[(($iWidth + 50) / 50) + 1][2]
    $aLine[0][0] = (($iWidth + 50) / 50)

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

    For $i = 0 To (($iWidth + 50) / 50) - 1 ; Bergspitzen random bestimmen
    _Often("$iLast")
    $aLine[$i + 1][0] = $i * 50
    $aLine[$i + 1][1] = $iLast
    Next

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

    $hGUI = GUICreate("", $iWidth, $iHeight)
    GUISetOnEvent(-3, "OnEvent_Eventhandler")
    GUIRegisterMsg($WM_PAINT, "WM_PAINT")

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

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + $GUI_Back_Color)
    $hGreenBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + 0x4FE369)
    $hGreyBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + 0x959595)
    $hYellowBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + 0xFFFF1C)
    $hOrangeBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + 0xFCE074)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic)
    $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)

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

    GUISetState()
    While 1 * Sleep(200)
    _MoveGreen()
    WEnd

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

    Func OnEvent_Eventhandler()
    Switch @GUI_CtrlId
    Case -3
    Exit
    EndSwitch
    EndFunc ;==>OnEvent_Eventhandler

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

    Func WM_PAINT()
    _GDIPlus_GraphicsClear($hBackbuffer, 0xFF000000 + $GUI_Back_Color)

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

    _GDIPlus_GraphicsFillEllipse($hBackbuffer, 5, 5, 110, 110, $hOrangeBrush) ; Sonne malen
    _GDIPlus_GraphicsFillEllipse($hBackbuffer, 10, 10, 100, 100, $hYellowBrush)

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

    _Berge_malen("Rand")
    _Berge_malen("Innen")

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

    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iWidth, $iHeight)
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_PAINT

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

    ;~ Func __GDIPlus_StartUp()
    ;~ EndFunc

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

    Func __GDIPlus_Shutdown()
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_BrushDispose($hGreyBrush)
    _GDIPlus_BrushDispose($hGreenBrush)
    _GDIPlus_BrushDispose($hYellowBrush)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_Shutdown()
    EndFunc ;==>__GDIPlus_Shutdown

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

    Func _MoveGreen()
    Local $iUbound = UBound($aLine)
    For $i = 1 To $iUbound - 2
    $aLine[$i][1] = $aLine[$i + 1][1]
    ;~ $aLine[$i][0] = $aLine[$i+1][0]
    Next
    _Often("il")
    $aLine[$iUbound - 1][1] = $iLast
    WM_PAINT()
    ;~ For $i = 0 To (($iWidth + 50) / 50) - 1 ; Bergspitzen random bestimmen
    ;~ $aLine[$i + 1][0] = $i * 50
    ;~ $aLine[$i + 1][1] = $iLast
    ;~ Next
    EndFunc ;==>_MoveGreen

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

    Func _Often($sWhat)
    Switch $sWhat
    Case "$iLast", "iLast", "il"
    $iRnd = Random(0, 10, 1) ; 50 / 50 Chance
    $iRnd2 = Random(10, 30, 1) ; Steigung
    $iLast += 0 + (($iRnd >= 5) * $iRnd2) - (($iRnd < 5) * $iRnd2)
    If $iLast > 200 Then $iLast = 200
    If $iLast < 100 Then $iLast = 100
    EndSwitch
    EndFunc ;==>_Often

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

    Func _Berge_malen($sWhat)
    Switch $sWhat
    Case "rand"
    For $i = 1 To UBound($aLine) - 1 ; Berge malen (Rand)
    $iLX = 0 + ($aLine[$i][0] > $iWidth / 2) * ($iWidth / 2) ; X koordinate links unten
    $iRX = $iLX + ($iWidth / 2) ; X koordinate rechts unten
    Dim $aPoints[4][2] = [[3, ""],[$iLX, $iHeight],[$aLine[$i][0], $aLine[$i][1] - 10],[$iRX, $iHeight]]

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

    If $aLine[$i][0] = $iWidth / 2 Then
    Dim $aPoints[4][2] = [[3, ""],[$iWidth * 0.25, $iHeight],[$aLine[$i][0], $aLine[$i][1] - 10],[$iWidth * 0.75, $iHeight]]
    EndIf
    _GDIPlus_GraphicsFillPolygon($hBackbuffer, $aPoints, $hGreyBrush)
    Next
    Case "innen"
    For $i = 1 To UBound($aLine) - 1 ; Berge malen (Innen)
    $iLX = 0 + ($aLine[$i][0] > $iWidth / 2) * ($iWidth / 2) ; X koordinate links unten
    $iRX = $iLX + ($iWidth / 2) ; X koordinate rechts unten
    Dim $aPoints[4][2] = [[3, ""],[$iLX, $iHeight],[$aLine[$i][0], $aLine[$i][1]],[$iRX, $iHeight]]

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

    If $aLine[$i][0] = $iWidth / 2 Then
    Dim $aPoints[4][2] = [[3, ""],[$iWidth * 0.25, $iHeight],[$aLine[$i][0], $aLine[$i][1]],[$iWidth * 0.75, $iHeight]]
    EndIf
    _GDIPlus_GraphicsFillPolygon($hBackbuffer, $aPoints, $hGreenBrush)
    Next
    EndSwitch
    EndFunc ;==>_Berge_malen

    [/autoit]

    Naja wenn wem noch was einfällt: immer her damit :D


    @Prog@andy:
    Na dann bin ich mal gespannt wie das mit scrollen aussieht. würd mir sehr helfen.
    (Am besten wenn der untere Bereich gefüllt ist :D)

  • GDI+ Sinuskurve

    • SEuBo
    • 11. März 2010 um 13:10

    Hat mir sehr geholfen danke!

    Nun noch eine Frage:
    Folgendes Script flackert trotz BackBuffer sehr stark

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GDIPlus.au3>
    Opt("GUIOnEventMode", 1)
    OnAutoItExitRegister("__GDIPlus_Shutdown")
    _GDIPlus_Startup()

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

    Global $iSpeed = 5

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

    Global $iDegToRad = 3.14159265358979 / 180
    Global $iWidth = 800, $iHeight = 200
    $GUI_Back_Color = 0xF0F0F0

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

    Dim $aLine[43][2] = [[42, ""],[0 - 10, $iHeight + 10]] ; Array mit koordinaten für _GDIPlus_Graphicsdrawcurve
    For $i = 2 To UBound($aLine) - 2
    $aLine[$i][0] = ($i - 1) * 20
    $aLine[$i][1] = $iHeight / 1.5 + Sin(($i - 1) * Random(10, 30, 1) * $iDegToRad) * 100
    Next
    $aLine[42][0] = $iWidth - 10
    $aLine[42][1] = $iHeight + 10

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

    ;~ _ArrayDisplay($aLine)

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

    $hGUI = GUICreate("", $iWidth, $iHeight)
    GUISetOnEvent(-3, "OnEvent_Eventhandler")
    GUIRegisterMsg($WM_PAINT, "WM_PAINT")

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

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + $GUI_Back_Color)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic)
    $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)

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

    GUISetState()
    While 1 * Sleep(10)
    Local $iUbound = UBound($aLine)
    For $i = 2 To $iUbound - 3 ; Alle außer die Eckpunkten ul & ur
    $aLine[$i][0] = $aLine[$i][0] - $iSpeed ; geschwindigkeit von X-Koordinate abziehen (Bewegung links)
    Next

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

    If $aLine[2][0] <= 0 Then ; Wenn erster richtiger punkt X <= 0 hat, dann
    For $i = 2 To $iUbound - 3
    $aLine[$i][1] = $aLine[$i + 1][1] ; Alle punkte im Array eins nach oben schieben,
    $aLine[$i][0] = $aLine[$i + 1][0]
    Next
    $aLine[$iUbound - 2][1] = $iHeight / 1.5 + Sin(($iUbound - 2) * Random(10, 30, 1) * $iDegToRad) * 100 ; Und neue Koordinate einfügen (Sonst ist die bewegung vorbei, wenn 1x alle punkte durch sind)
    EndIf
    ;~ _ArrayDisplay($aLine)
    WM_PAINT()
    WEnd

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

    Func OnEvent_Eventhandler()
    Switch @GUI_CtrlId
    Case -3
    Exit
    EndSwitch
    EndFunc ;==>OnEvent_Eventhandler

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

    Func WM_PAINT()
    _GDIPlus_GraphicsClear($hBackbuffer, 0xFF000000 + $GUI_Back_Color)
    ;~ _GDIPlus_GraphicsDrawClosedCurve($hBackbuffer, $aLine)
    _GDIPlus_GraphicsFillClosedCurve($hBackbuffer, $aLine)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iWidth, $iHeight)
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_PAINT

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

    Func __GDIPlus_Shutdown()
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_Shutdown()
    EndFunc ;==>__GDIPlus_Shutdown

    [/autoit]

    Eigentlich funktioniert alles wie es soll, aber es flackert halt sehr stark :S
    Wo liegt mein Fehler? Und welche anderen Möglichkeiten gäbe es, sowas zu zeichnen?

    hat jemand zufällig ein Beispielscript in dem eine Landschaft generiert wird?
    Würde mich mal interessieren wie sowas vom Code her aussieht

  • DescribeIt - Funktionsheader leicht gemacht (Alpha)

    • SEuBo
    • 11. März 2010 um 12:11

    Hey das ist ja mal sau geil. Ich werd da nochmal drübergucken wenn ich nachher Zeit habe.
    Dickes dankeschön auf jeden Fall

  • GDI+ Sinuskurve

    • SEuBo
    • 11. März 2010 um 02:27

    So langsam komm ich mir schon blöd vor :S

    Ich habe mal diesen einfachen Blitz3D Code geschrieben:

    Code
    Graphics 640,480,16,3
    For I = 0 To 720
    	Color 255,0,255
    	Plot I,240+(Sin(I)*100)
    Next
    WaitKey


    Dabei kommt folgendes raus:
    Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist.
    Wenn ich das aber in AutoIt Code übersetze,

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <WindowsConstants.au3>
    $hGUI = GUICreate("Sinuskurve", 640, 480)
    GUIRegisterMsg($WM_PAINT, "WM_PAINT")

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

    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)

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

    GUISetState()
    Do
    Until GUIGetMsg() = -3

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

    Func WM_PAINT()
    For $i = 0 To 720
    _GDIPlus_GraphicsFillRect($hGraphic,$i,240 + (Sin($i) * 100),1,1)
    Next
    EndFunc ;==>WM_PAINT

    [/autoit]


    Erhalte ich das hier:
    Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist.

    Da stellt sich mir eine Frage:

    WARUM!?


    Ich glaub echt langsam, dass ich blöd geworden bin nach einem Jahr ohne Schule. Ich glaub der ganze Mathekram ist weg :D

    ... Leider nicht unbedingt vorteilhaft für GDI+ :D

    Dateien

    sinus.png 37,21 kB – 0 Downloads KEINsinus.png 11,89 kB – 0 Downloads
  • WinSlide UDF

    • SEuBo
    • 11. März 2010 um 00:19

    Hallo,
    ausgehend von meinem Scriptbeispiel für Slide-GUI's hatte ich mal eine UDF gebastelt.
    Ich hab mich nur vorm kommentieren gescheut (übrigens war diese UDF der Grund dafür, dass DescribeIt entstanden ist)

    Jetzt hab ich das mal schnell alles kommentiert und ein Beispiel erstellt.
    Vielleicht nützt es ja einem was ;)

    Example
    [autoit]

    #include <WindowsConstants.au3>
    #include <_SlideUDF.au3>

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

    AutoItWinSetTitle("__DUMMY") ; Use the internal (invisible) AutoIt window as a dummy window.
    $hDummyHwnd = WinGetHandle("__DUMMY") ; We will use this as parent for our gui's
    ; so we wont see anything on the taskbar (pretty much like $WS_EX_TOOLWINDOW)

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

    ;Create GUI on the left side.
    $h_Left = GUICreate("SlideGUI left", 155, 350, -1, -1, -1, $WS_EX_TOPMOST, $hDummyHwnd)
    $_Button1 = GUICtrlCreateButton("(Un-)Lock Top", 40, 40, 100, 30)
    GUICtrlCreateEdit("Sample Edit...", 20, 90, 120, 200)
    _Slide_WinSetSlide($h_Left, "left") ; Apply slide mode on the left side.
    _Slide_SlideSetOnHover($h_Left) ; Apply slide on hover mode.

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

    ;Create GUI on the right.
    $h_Right = GUICreate("SlideGUI Right", 155, 350, -1, -1, -1, $WS_EX_TOPMOST, $hDummyHwnd)
    GUICtrlCreateEdit("Sample Edit...", 20, 20, 150, 300)
    _Slide_WinSetSlide($h_Right, "right") ; Apply slide mode for the right side.
    ; No Slide on hover for this one. We want to move it by ourself.

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

    $h_Bottom = GUICreate("SlideGUI Bottom", 350, 155, -1, -1, -1, $WS_EX_TOPMOST, $hDummyHwnd)
    GUICtrlCreateCheckbox("Sample Checkbox", 40, 30)
    GUICtrlCreateCombo("Combo", 140, 50)
    _Slide_WinSetSlide($h_Bottom, "bottom") ; Apply slide mode
    _Slide_SlideSetOnHover($h_Bottom) ; Apply slide on hover.

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

    $h_Top = GUICreate("SlideGUI Top", 350, 155, -1, -1, -1, $WS_EX_TOPMOST, $hDummyHwnd)
    $_ListView = GUICtrlCreateListView("Columnd 1|Column 2", 5, 5, 340, 145)
    GUICtrlCreateListViewItem("Item 1_1|Item 1_2", $_ListView)
    GUICtrlCreateListViewItem("Item 2_1|Item 2_2", $_ListView)
    GUICtrlCreateListViewItem("Item 3_1|Item 3_2", $_ListView)
    _Slide_WinSetSlide($h_Top, "top") ; Apply slide mode
    _Slide_SlideSetOnHover($h_Top) ; Apply slide on hover.

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

    _Slide_SlideIn($h_Top) ; Slide out top window,
    _Slide_SlideSetLock($h_Top) ; Lock it, so it wont trigger the Hover-Event.
    ; You can also use _Slide_SlideInLock($h_Top)

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

    $t = TimerInit()

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

    While 1 * Sleep(10)
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case -3
    Exit
    Case $_Button1
    $fLockedState = _Slide_SlideGetLock($h_Top) ; Retrieve the "locked"-state.
    Switch $fLockedState
    Case False ; if not locked, slide in, and lock (so it wont trigger OnHover)
    _Slide_SlideInLock($h_Top)
    Case True ; if locked, slide out, and unlock (so it _will_ trigger onHover)
    _Slide_SlideOutLock($h_Top, False)
    EndSwitch
    Case Else
    If TimerDiff($t) > 3000 Then
    $fSlideState = _Slide_WingetSlideState($h_Right) ; Retrive the Slide-state.
    Switch $fSlideState
    Case False ; If slide out, slide in.
    _Slide_SlideIn($h_Right)
    Case True ; If slide in, slide out.
    _Slide_SlideOut($h_Right)
    EndSwitch
    $t = TimerInit()
    EndIf
    EndSwitch
    WEnd

    [/autoit]
    _SlideUDF.au3
    [autoit]

    Global $__SLIDE_aGUI[1][5] = [["Winhandle", "sSide", "sState", "locked", "OnHover"]]
    Global $__SLIDE_hDLL = DllOpen("user32.dll") ; Open the DLL for WinIsHovered (faster with DLL-handle)
    AdlibRegister("__Slide_CheckHover", 100)
    OnAutoItExitRegister("__Slide_UnloadDLL")

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

    ; #FUNCTION# ======================================================================================
    ; Name ..........: _Slide_SlideGetLock()
    ; Description ...: Returns the "Locked"-State if a slide-GUI
    ; Syntax ........: _Slide_SlideGetLock($hWnd)
    ; Parameters ....: $hWnd - Window Handle
    ; Return values .: Success - Returns 1
    ; Failure - Returns 0 and sets @error to:
    ; |1 - Wrong Parameters
    ; Author ........: SEuBo
    ; Modified ......: 01.03.2010
    ; Remarks .......: Window must be registered by _Slide_WinSetSlide first.
    ; Example .......: Yes
    ; =================================================================================================
    Func _Slide_SlideGetLock($hWnd)
    If Not IsHWnd($hWnd) Then $hWnd = WinGetHandle($hWnd)
    If @error Then Return SetError(1, 0, 0)

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

    For $i = 1 To UBound($__SLIDE_aGUI) - 1
    If $hWnd = $__SLIDE_aGUI[$i][0] Then Return SetError(0, 0, $__SLIDE_aGUI[$i][3])
    Next
    Return SetError(2, 0, 0)
    EndFunc ;==>_Slide_SlideGetLock

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

    ; #FUNCTION# ======================================================================================
    ; Name ..........: _Slide_SlideIn()
    ; Description ...: Slides in a window.
    ; Syntax ........: _Slide_SlideIn($hWnd)
    ; Parameters ....: $hWnd - Window handle to slide
    ; Return values .: Success
    ; |None
    ; Failure - Returns 0 and sets @error
    ; |1 - Could not retrieve Window handle
    ; |2 - Window is not registered yet
    ; |3 - Window already slide in
    ; Author ........: SEuBo
    ; Modified ......: 01.03.2010
    ; Remarks .......: The window must be registered with _Slide_WinSetSlide() first.
    ; =================================================================================================
    Func _Slide_SlideIn($hWnd)
    If Not IsHWnd($hWnd) Then $hWnd = WinGetHandle($hWnd)
    If @error Then Return SetError(1, 0, 0)

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

    For $i = 1 To UBound($__SLIDE_aGUI) - 1
    If $__SLIDE_aGUI[$i][0] = $hWnd Then
    If Not $__SLIDE_aGUI[$i][2] Then
    __Slide_WinSlide($hWnd, "in", $__SLIDE_aGUI[$i][1])
    $__SLIDE_aGUI[$i][2] = True
    Else
    Return SetError(3, 0, 0)
    EndIf
    EndIf
    Next
    Return SetError(2, 0, 0)
    EndFunc ;==>_Slide_SlideIn

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

    ; #FUNCTION# ======================================================================================
    ; Name ..........: _Slide_SlideInLock()
    ; Description ...: Slides in and locks a window.
    ; Syntax ........: _Slide_SlideInLock($hWnd[, $fLocked = True])
    ; Parameters ....: $hWnd - Window handle to slide & lock
    ; $fLocked - [optional] Lock or unlock the window (default:True)
    ; |True - Locked
    ; |False - Unlocked
    ; Return values .: None.
    ; Author ........: SEuBo
    ; Modified ......: 01.03.2010
    ; Remarks .......: The window must be registered with _Slide_WinSetSlide() first.
    ; =================================================================================================
    Func _Slide_SlideInLock($hWnd, $fLocked = True)
    _Slide_slideIn($hWnd)
    _Slide_SlideSetLock($hWnd, $fLocked)
    EndFunc ;==>_Slide_SlideInLock

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

    ; #FUNCTION# ======================================================================================
    ; Name ..........: _Slide_SlideOut()
    ; Description ...: Slides out a window.
    ; Syntax ........: _Slide_SlideOut($hWnd)
    ; Parameters ....: $hWnd - Window handle to slide
    ; Return values .: Success
    ; |None
    ; Failure - Returns 0 and sets @error
    ; |1 - Could not retrieve Window handle
    ; |2 - Window is not registered yet
    ; |3 - Window already slide out
    ; Author ........: SEuBo
    ; Modified ......: 01.03.2010
    ; Remarks .......: The window must be registered with _Slide_WinSetSlide() first.
    ; Example .......: No
    ; =================================================================================================
    Func _Slide_SlideOut($hWnd)
    If Not IsHWnd($hWnd) Then $hWnd = WinGetHandle($hWnd)
    If @error Then Return SetError(1, 0, 0)

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

    For $i = 1 To UBound($__SLIDE_aGUI) - 1
    If $__SLIDE_aGUI[$i][0] = $hWnd Then
    If $__SLIDE_aGUI[$i][2] Then
    __Slide_WinSlide($hWnd, "out", $__SLIDE_aGUI[$i][1])
    $__SLIDE_aGUI[$i][2] = False
    Return SetError(0, 0, 1)
    Else
    Return SetError(3, 0, 0)
    EndIf
    EndIf
    Next
    Return SetError(2, 0, 0)
    EndFunc ;==>_Slide_SlideOut

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

    ; #FUNCTION# ======================================================================================
    ; Name ..........: _Slide_SlideOutLock()
    ; Description ...: Slides in and locks a window.
    ; Syntax ........: _Slide_SlideOutLock($hWnd[, $fLocked = True])
    ; Parameters ....: $hWnd - Window handle to slide
    ; $fLocked - [optional] Lock or unlock the window (default:True)
    ; |True - Locked
    ; |False - Unlocked
    ; Return values .: None.
    ; Author ........: SEuBo
    ; Modified ......: 01.03.2010
    ; Remarks .......: The window must be registered with _Slide_WinSetSlide() first.
    ; Example .......: No
    ; =================================================================================================
    Func _Slide_SlideOutLock($hWnd, $fLocked = True)
    _Slide_slideOut($hWnd)
    _Slide_SlideSetLock($hWnd, $fLocked)
    EndFunc ;==>_Slide_SlideOutLock

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

    ; #FUNCTION# ======================================================================================
    ; Name ..........: _Slide_SlideSetLock()
    ; Description ...: Changes the locked state of a window.
    ; Syntax ........: _Slide_SlideSetLock($hWnd[, $fLocked = True])
    ; Parameters ....: $hWnd - Window handle to lock
    ; $fLocked - [optional] New locked state. (default:True)
    ; Return values .: Success - 1
    ; Failure - Returns 0 and sets @error
    ; |1 - Could not retrieve window handle
    ; |2 - Window is not registered yet
    ; Author ........: SEuBo
    ; Modified ......: 01.03.2010
    ; Remarks .......: Use this function if you want to slide out a window, which has the Slide on Hover state.
    ; Example .......: No
    ; =================================================================================================
    Func _Slide_SlideSetLock($hWnd, $fLocked = True)
    If Not IsHWnd($hWnd) Then $hWnd = WinGetHandle($hWnd)
    If @error Then Return SetError(1, 0, 0)

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

    For $i = 1 To UBound($__SLIDE_aGUI) - 1
    If $hWnd = $__SLIDE_aGUI[$i][0] Then
    $__SLIDE_aGUI[$i][3] = $fLocked
    Return SetError(0, 0, 1)
    EndIf
    Next
    Return SetError(2, 0, 0)
    EndFunc ;==>_Slide_SlideSetLock

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

    ; #FUNCTION# ======================================================================================
    ; Name ..........: _Slide_SlideSetOnHover()
    ; Description ...: Add or remove a Window to the slide on hover register
    ; Syntax ........: _Slide_SlideSetOnHover($hWnd[, $sMode = True])
    ; Parameters ....: $hWnd - Window handle to add / remove
    ; $sMode - [optional] Add or remove the Window (default:True)
    ; |0 - Remove from register
    ; |1 - Add to register
    ; Return values .: Success - None
    ; Failure - 0 and sets @error
    ; |1 - Could not retrieve Window handle
    ; Author ........: Shkal
    ; Modified ......: 01.03.2010
    ; Remarks .......: None
    ; Example .......: No
    ; =================================================================================================
    Func _Slide_SlideSetOnHover($hWnd, $sMode = True)
    If Not IsHWnd($hWnd) Then $hWnd = WinGetHandle($hWnd)
    If @error Then Return SetError(1, 0, 0)

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

    $iUbound = UBound($__SLIDE_aGUI)
    Switch $sMode
    Case True
    For $i = 1 To UBound($__SLIDE_aGUI) - 1
    If $__SLIDE_aGUI[$i][0] = $hWnd Then
    $__SLIDE_aGUI[$i][4] = True
    EndIf
    Next
    Case False
    For $i = 1 To UBound($__SLIDE_aGUI) - 1
    If $__SLIDE_aGUI[$i][0] = $hWnd Then
    $__SLIDE_aGUI[$i][4] = False
    EndIf
    Next
    EndSwitch
    EndFunc ;==>_Slide_SlideSetOnHover

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

    ; #FUNCTION# ======================================================================================
    ; Name ..........: _Slide_WinGetSlideState()
    ; Description ...: Returns the "Slide"-State if a slide-GUI
    ; Syntax ........: _Slide_WinGetSlideState($hWnd)
    ; Parameters ....: $hWnd - Window handle to retrieve slide state from
    ; Return values .: Success - Returns Slide State
    ; |True = slide in
    ; |False = slide out
    ; Failure - Returns 0 and sets @error to:
    ; |1 - Wrong Parameters
    ; Author ........: SEuBo
    ; Modified ......: 01.03.2010
    ; Remarks .......: Window must be registered by _Slide_WinSetSlide first.
    ; Example .......: Yes
    ; =================================================================================================
    Func _Slide_WinGetSlideState($hWnd)
    If Not IsHWnd($hWnd) Then $hWnd = WinGetHandle($hWnd)
    If @error Then Return SetError(1, 0, 0)

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

    For $i = 1 To UBound($__SLIDE_aGUI) - 1
    If $hWnd = $__SLIDE_aGUI[$i][0] Then Return SetError(0, 0, $__SLIDE_aGUI[$i][2])
    Next
    Return SetError(2, 0, -1)
    EndFunc ;==>_Slide_WinGetSlideState

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

    ; #FUNCTION# ======================================================================================
    ; Name ..........: _Slide_WinSetSlide()
    ; Description ...: Add or remove a Window to the slide register
    ; Syntax ........: _Slide_WinSetSlide($hWnd, $sSide[, $iMode = 1])
    ; Parameters ....: $hWnd - Window handle to add / remove
    ; $sSide - Side where you want the window to be placed
    ; |top
    ; |left
    ; |right
    ; |bottom
    ; $iMode - [optional] Add or remove window handle from / to register (default:1)
    ; |1 - Add window handle
    ; |2 - remove window handle
    ; Return values .: Success - None
    ; Failure - 0 and sets @error
    ; |1 - Wrong parameters
    ; Author ........: SEuBo
    ; Modified ......: 01.03.2010
    ; =================================================================================================
    Func _Slide_WinSetSlide($hWnd, $sSide, $iMode = 1)

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

    If Not IsHWnd($hWnd) Then $hWnd = WinGetHandle($hWnd)
    If @error Then Return SetError(1, 0, 0)
    If $iMode > 1 Or $iMode < 0 Then Return SetError(1, 0, 0)
    If Not StringRegExp($sSide, "(?i)(left|right|top|bottom)") Then Return SetError(1, 0, 0)

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

    $iUbound = UBound($__SLIDE_aGUI)
    Switch $iMode
    Case 1
    ReDim $__SLIDE_aGUI[$iUbound + 1][5]
    $__SLIDE_aGUI[$iUbound][0] = $hWnd
    $__SLIDE_aGUI[$iUbound][1] = $sSide
    $__SLIDE_aGUI[$iUbound][2] = True
    $__SLIDE_aGUI[$iUbound][3] = False
    $__SLIDE_aGUI[$iUbound][4] = False
    _Slide_SlideOut($hWnd)
    GUISetState(@SW_SHOWNOACTIVATE, $hWnd)
    Case 0
    For $i = 1 To UBound($__SLIDE_aGUI) - 1
    If $__SLIDE_aGUI[$i][0] = $hWnd Then
    For $j = $i To UBound($__SLIDE_aGUI) - 2
    $__SLIDE_aGUI[$j][0] = $__SLIDE_aGUI[$j + 1][0]
    $__SLIDE_aGUI[$j][1] = $__SLIDE_aGUI[$j + 1][1]
    $__SLIDE_aGUI[$j][2] = $__SLIDE_aGUI[$j + 1][2]
    $__SLIDE_aGUI[$j][3] = $__SLIDE_aGUI[$j + 1][3]
    $__SLIDE_aGUI[$j][4] = $__SLIDE_aGUI[$j + 1][4]
    ReDim $__SLIDE_aGUI[UBound($__SLIDE_aGUI) - 1][5]
    _Slide_SlideIn($hWnd)
    GUISetState(@SW_HIDE, $hWnd)
    Next
    EndIf
    Next

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

    EndSwitch
    EndFunc ;==>_Slide_WinSetSlide

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

    ; #FUNCTION# ======================================================================================
    ; Name ..........: __Slide_CheckHover()
    ; Description ...: Internal function. This function is doing the slide-on-hover event.
    ; Syntax ........: __Slide_CheckHover()
    ; Return values .: None
    ; Author ........: SEuBo
    ; Modified ......: 01.03.2010
    ; Remarks .......: Window must be registered by _Slide_WinSetSlide first.
    ; Related .......: __Slide_WinIsHovered, _Slide_SlideSetOnHover
    ; Example .......: No
    ; =================================================================================================
    Func __Slide_CheckHover()
    For $i = 1 To UBound($__SLIDE_aGUI) - 1
    If $__SLIDE_aGUI[$i][4] Then
    If Not $__SLIDE_aGUI[$i][3] Then
    If __Slide_WinIsHovered($__SLIDE_aGUI[$i][0]) Then
    If Not $__SLIDE_aGUI[$i][2] Then _Slide_SlideIn($__SLIDE_aGUI[$i][0])
    Else
    If $__SLIDE_aGUI[$i][2] Then _Slide_SlideOut($__SLIDE_aGUI[$i][0])
    EndIf
    EndIf
    EndIf
    Next
    EndFunc ;==>__Slide_CheckHover

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

    ; #FUNCTION# ======================================================================================
    ; Name ..........: __Slide_UnloadDLL()
    ; Description ...: Internal function. Closes the DLL Handle, opened at startup.
    ; Syntax ........: __Slide_UnloadDLL()
    ; Return values .: None
    ; Author ........: SEuBo
    ; Modified ......: 01.03.2010
    ; Remarks .......: Window must be registered by _Slide_WinSetSlide first.
    ; Related .......: __Slide_CheckHover, _Slide_SlideSetOnHover
    ; Example .......: No
    ; =================================================================================================
    Func __Slide_UnloadDLL()
    DllClose($__SLIDE_hDLL)
    EndFunc ;==>__Slide_UnloadDLL

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

    ; #FUNCTION# ======================================================================================
    ; Name ..........: __Slide_WinIsHovered()
    ; Description ...: Internal function. Uses WinAPI PtInRect to determine weither the Window is hovered or not.
    ; Syntax ........: __Slide_WinIsHovered($hWnd[, $vDLL = "User32.dll"])
    ; Parameters ....: $hWnd - Window handle to check
    ; $vDLL - [optional] DLL Handle to user32.dll. (default:"User32.dll")
    ; |If no handle is passed, the function will open the DLL by itself. (Like _IsPressed)
    ; Return values .: Success - True
    ; Failure - False
    ; Author ........: Shkal
    ; Modified ......: 01.03.2010
    ; Remarks .......: Window must be registered by _Slide_WinSetSlide first.
    ; Related .......: __Slide_CheckHover, _Slide_SlideSetOnHover
    ; Example .......: Yes
    ; =================================================================================================
    Func __Slide_WinIsHovered($hWnd, $vDLL = "User32.dll")
    Local $aResult, $aWPos = WinGetPos($hWnd), $aMPos = MouseGetPos()
    Local $tRect = DllStructCreate("int Left;int Top;int Right;int Bottom")
    Local $iLeft = $aWPos[0], $iTop = $aWPos[1], $iWidth = $aWPos[2], $iHeight = $aWPos[3]
    Local $iX = $aMPos[0], $iY = $aMPos[1]
    DllStructSetData($tRect, "Left", $iLeft)
    DllStructSetData($tRect, "Top", $iTop)
    DllStructSetData($tRect, "Right", $iLeft + $iWidth)
    DllStructSetData($tRect, "Bottom", $iTop + $iHeight)

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

    $aResult = DllCall($vDLL, "int", "PtInRect", "ptr", DllStructGetPtr($tRect), "int", $iX, "int", $iY)
    If @error Then Return SetError(@error, 0, False)

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

    Return $aResult[0] <> 0
    EndFunc ;==>__Slide_WinIsHovered

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

    ; #FUNCTION# ======================================================================================
    ; Name ..........: __Slide_WinSlide()
    ; Description ...: Internal Function. This one takes care about the movement.
    ; Syntax ........: __Slide_WinSlide($hWnd, $sMode, $sSide)
    ; Parameters ....: $hWnd - Window handle
    ; $sMode - Mode
    ; |in
    ; |out
    ; $sSide - Side to slide at
    ; |left
    ; |right
    ; |top
    ; |bottom
    ; Return values .: None
    ; Author ........: SEuBo
    ; Modified ......: 01.03.2010
    ; Remarks .......: Window must be registered by _Slide_WinSetSlide first.
    ; Example .......: Yes
    ; =================================================================================================
    Func __Slide_WinSlide($hWnd, $sMode, $sSide)
    ;$hWnd = Window to slide.
    ;$sMode = Slide-In or -out (in|out)
    ;$sSide = Side where you want the GUI to slide. (left|right|top|bottom)
    Local $aScreen_Res = WinGetPos(WinGetHandle("Program Manager"))
    Local $aWPos = WinGetPos($hWnd), $m = 0 - ($sMode = "in") + ($sMode = "out")
    Local $h = 0 - ($sSide = "left") + ($sSide = "right"), $v = 0 - ($sSide = "top") + ($sSide = "bottom")

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

    WinMove($hWnd, "", _ ; Move GUI according to $sMode and $sSide.
    $aScreen_Res[0] - (($h = -1) * ($m = -1) * ($aWPos[2] - 10)) _
    + (($h = 1) * (($h = 1) * $aScreen_Res[2] - (10 * ($m = -1)) - ($m <> -1) * $aWPos[2])) _
    + (($h = 0) * (($h = 0) * ($aScreen_Res[2] / 2) - ($aWPos[2] / 2))) _
    , _
    $aScreen_Res[1] - (($v = -1) * ($m = -1) * ($aWPos[3] - 10)) _
    + (($v = 1) * (($v = 1) * $aScreen_Res[3] - (10 * ($m = -1)) - ($m <> -1) * $aWPos[3])) _
    + (($v = 0) * (($v = 0) * ($aScreen_Res[3] / 2) - ($aWPos[3] / 2))) _
    )

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

    $aWPos = WinGetPos($hWnd)
    ; Slide GUI.
    Switch $sSide
    Case "left", "right"
    Local $STEP = (((($h = 1) And ($m = 1)) Or (($h = -1) And ($m = -1))) - ((($h = -1) And ($m = 1)) Or (($h = 1) And ($m = -1)))) * 10
    Local $FROM = $aWPos[0], $TO = $aWPos[0] _
    + (((($h = 1) And ($m = 1)) Or (($h = -1) And ($m = -1))) * ($aWPos[2])) _
    - (((($h = 1) And ($m = -1)) Or (($h = -1) And ($m = 1))) * ($aWPos[2])) - $STEP
    For $i = $aWPos[0] To $TO Step $STEP
    WinMove($hWnd, "", $i, $aWPos[1])
    Sleep(10)
    Next
    Case "top", "bottom"
    Local $STEP = (((($v = 1) And ($m = 1)) Or (($v = -1) And ($m = -1))) - ((($v = -1) And ($m = 1)) Or (($v = 1) And ($m = -1)))) * 10
    Local $FROM = $aWPos[1], $TO = $aWPos[1] _
    + (((($v = 1) And ($m = 1)) Or (($v = -1) And ($m = -1))) * ($aWPos[3])) _
    - (((($v = 1) And ($m = -1)) Or (($v = -1) And ($m = 1))) * ($aWPos[3])) - $STEP
    For $i = $aWPos[1] To $TO Step $STEP
    WinMove($hWnd, "", $aWPos[0], $i)
    Sleep(10)
    Next
    EndSwitch
    EndFunc ;==>__Slide_WinSlide

    [/autoit]

    Dateien

    _SlideUDF.zip 302,58 kB – 653 Downloads
  • YouTube Stream without IE-Objekt!

    • SEuBo
    • 10. März 2010 um 22:05

    nur so ne idee: kann man nicht einfach ein shockwave flash objekt einbinden und dann normal streamen?

  • Anzahl Ordner und dateien Aufzählen...

    • SEuBo
    • 10. März 2010 um 17:34
    Zitat

    Rückgabewert ist ein Array mit der Anzahl gefundener Pfade in Array[0].


    Du musst doch nur die Daten in ein Array lesen, und hast dann in Array[0] die Anzahl

  • Anzahl Ordner und dateien Aufzählen...

    • SEuBo
    • 10. März 2010 um 17:24

    https://autoit.de/index.php?page…50205#post50205

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™