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. Nestos

Beiträge von Nestos

  • Gui Inhalt Löschen

    • Nestos
    • 26. März 2010 um 22:23
    [autoit]

    ControlGetPos()

    [/autoit]

    Würd ich mal sagen. ^^

    Edit:

    [autoit]

    ; Übergib ein Array, mit allen Controls, die in der GUI sind.
    ; $ctrl[0] = Anzahl der Controls
    ; $ctrl[1] = Control 1
    ; $ctrl[2] = Control 2
    ; $ctrl[n] = Control n
    ; x, y, width, height müsste klar sein

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

    Func _CtrlDel($gui, $ctrl, $x, $y, $width, $height)
    Local $pos

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

    For $i = 1 To $ctrl[0] Step + 1
    $pos = ControlGetPos($gui, "", $ctrl[$i])
    If $pos[0] > $X And $pos[0] < $width And $pos[1] > $Y And $pos[1] < $Height Then
    GUICtrlDelete($ctrl[$i])
    EndIf
    Next
    Endfunc

    [/autoit]

    Habs jetzt nicht getestet! Nur mal so schnell geschrieben.

  • GDI+ Bitmap Effekte

    • Nestos
    • 26. März 2010 um 21:17

    Also mit transparenten Bildern, will das nicht so ganz, ansonsten funktioniert es eigentlich ganz gut.

  • Process Control - Nur Programme in Whitelist erlauben

    • Nestos
    • 26. März 2010 um 19:16

    Schaut ja mal wirklich nett aus.

    Top! ;D

  • GDI+ Beispiel: Matrizen

    • Nestos
    • 23. März 2010 um 18:27

    Ja ich hatte vor einiger Zeit einmal Langeweile, und dachte mir, dass ich mal wieder was mit GDI+ mach.
    Da mir aber die Berechnungen mit den Winkelfunktionen zu umständlich sind, hab ich mich mal an Matrizen versucht.

    Und tada, hier ist:

    Spoiler anzeigen
    [autoit]

    #include <WinAPI.au3>
    #include <GDIPlus.au3>
    #include <Misc.au3>

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

    Opt("GUIOnEventMode", 1)

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

    Global $hWnd, $hGraphic, $hBitmap, $backbuffer[4], $hFormat, $hFamily, $hFont, $tLayout, $aInfo, $matrix[3]
    Global $pen[1]
    Global $ScreenDc, $dc, $tSize, $pSize, $tSource, $pSource, $tBlend, $pBlend, $tPoint, $pPoint, $gdibitmap
    Global $title = "GDI+ Beispiel: Matrizen", _
    $width = 700, _
    $height = 700
    Global $Colour = 0x00FF0000, _
    $Count = 3
    $CountR = 1

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

    $hWnd = GUICreate($title, $width, $height, -1, -1, 0x80000000, BitOR(0x00000080, 0x00080000, 0x00000008))
    GUISetOnEvent(-3, "_Close")
    GUISetState()

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

    _Win_SetClickThrough($hWnd, True)

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

    _Startup()

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

    AdlibRegister("_Draw", 10)
    AdlibRegister("_Key", 10)

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

    While 1
    Sleep(100)
    WEnd

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

    Func _Draw()
    If $Count = 1 Then
    $Colour -= 0x01000100
    _GDIPlus_PenSetColor($pen[0], $Colour)
    If Hex($Colour) = Hex(0x00FF0000) Then $Count = 2
    ElseIf $Count < 3 And $Count >= 2 Then
    $Count += 0.01
    ElseIf $Count >= 3 Then
    $Colour += 0x01000100
    _GDIPlus_PenSetColor($pen[0], $Colour)
    If Hex($Colour) = Hex(0xFFFFFF00) Then $Count = 1
    EndIf

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

    _GDIPlus_GraphicsClear($backbuffer[2], 0x00000000)

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

    _GDIPlus_MatrixRotate($matrix[0], $CountR)
    _GDIPlus_GraphicsSetTransform($backbuffer[0], $matrix[0])
    _GDIPlus_GraphicsDrawLine($backbuffer[0], 0, -100, 0, 100, $pen[0])
    _GDIPlus_GraphicsDrawLine($backbuffer[0], -100, 0, 100, 0, $pen[0])
    _GDIPlus_GraphicsDrawEllipse($backbuffer[0], -100, -100, 200, 200, $pen[0])
    _GDIPlus_GraphicsDrawRect($backbuffer[0], -50, -50, 100, 100, $pen[0])

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

    _GDIPlus_GraphicsDrawEllipse($backbuffer[0], -250, 50, 200, 200, $pen[0])
    _GDIPlus_GraphicsDrawRect($backbuffer[0], 100, 100, 100, 100, $pen[0])
    _GDIPlus_GraphicsDrawLine($backbuffer[0], 150, 50, 150, 250, $pen[0])
    _GDIPlus_GraphicsDrawLine($backbuffer[0], 50, 150, 250, 150, $pen[0])

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

    _GDIPlus_GraphicsDrawEllipse($backbuffer[0], 50, 50, 200, 200, $pen[0])
    _GDIPlus_GraphicsDrawRect($backbuffer[0], -200, 100, 100, 100, $pen[0])
    _GDIPlus_GraphicsDrawLine($backbuffer[0], -150, 50, -150, 250, $pen[0])
    _GDIPlus_GraphicsDrawLine($backbuffer[0], -50, 150, -250, 150, $pen[0])

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

    _GDIPlus_GraphicsDrawEllipse($backbuffer[0], 50, -250, 200, 200, $pen[0])
    _GDIPlus_GraphicsDrawRect($backbuffer[0], -200, -200, 100, 100, $pen[0])
    _GDIPlus_GraphicsDrawLine($backbuffer[0], -150, -50, -150, -250, $pen[0])
    _GDIPlus_GraphicsDrawLine($backbuffer[0], -50, -150, -250, -150, $pen[0])

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

    _GDIPlus_GraphicsDrawEllipse($backbuffer[0], -250, -250, 200, 200, $pen[0])
    _GDIPlus_GraphicsDrawRect($backbuffer[0], 100, -200, 100, 100, $pen[0])
    _GDIPlus_GraphicsDrawLine($backbuffer[0], 150, -50, 150, -250, $pen[0])
    _GDIPlus_GraphicsDrawLine($backbuffer[0], 50, -150, 250, -150, $pen[0])

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

    _GDIPlus_MatrixRotate($matrix[1], -$CountR)
    _GDIPlus_GraphicsSetTransform($backbuffer[1], $matrix[1])
    _GDIPlus_GraphicsDrawRect($backbuffer[1], -50, -50, 100, 100, $pen[0])
    _GDIPlus_GraphicsDrawLine($backbuffer[1], 0, -100, 0, 100, $pen[0])
    _GDIPlus_GraphicsDrawLine($backbuffer[1], -100, 0, 100, 0, $pen[0])

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

    _GDIPlus_GraphicsDrawEllipse($backbuffer[1], -250, 50, 200, 200, $pen[0])
    _GDIPlus_GraphicsDrawRect($backbuffer[1], 100, 100, 100, 100, $pen[0])
    _GDIPlus_GraphicsDrawLine($backbuffer[1], 150, 50, 150, 250, $pen[0])
    _GDIPlus_GraphicsDrawLine($backbuffer[1], 50, 150, 250, 150, $pen[0])

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

    _GDIPlus_GraphicsDrawEllipse($backbuffer[1], 50, 50, 200, 200, $pen[0])
    _GDIPlus_GraphicsDrawRect($backbuffer[1], -200, 100, 100, 100, $pen[0])
    _GDIPlus_GraphicsDrawLine($backbuffer[1], -150, 50, -150, 250, $pen[0])
    _GDIPlus_GraphicsDrawLine($backbuffer[1], -50, 150, -250, 150, $pen[0])

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

    _GDIPlus_GraphicsDrawEllipse($backbuffer[1], 50, -250, 200, 200, $pen[0])
    _GDIPlus_GraphicsDrawRect($backbuffer[1], -200, -200, 100, 100, $pen[0])
    _GDIPlus_GraphicsDrawLine($backbuffer[1], -150, -50, -150, -250, $pen[0])
    _GDIPlus_GraphicsDrawLine($backbuffer[1], -50, -150, -250, -150, $pen[0])

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

    _GDIPlus_GraphicsDrawEllipse($backbuffer[1], -250, -250, 200, 200, $pen[0])
    _GDIPlus_GraphicsDrawRect($backbuffer[1], 100, -200, 100, 100, $pen[0])
    _GDIPlus_GraphicsDrawLine($backbuffer[1], 150, -50, 150, -250, $pen[0])
    _GDIPlus_GraphicsDrawLine($backbuffer[1], 50, -150, 250, -150, $pen[0])

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

    $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
    _WinAPI_SelectObject($dc, $gdibitmap)
    _WinAPI_UpdateLayeredWindow($hWnd, $ScreenDc, 0, $pSize, $dc, $pSource, 0, $pBlend, 2)
    _WinAPI_DeleteObject($gdibitmap)
    EndFunc

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

    Func _Key()
    If _IsPressed("6B") Then $CountR += 0.01
    If _IsPressed("6D") Then $CountR -= 0.01
    EndFunc

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

    Func _Startup()
    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $hGraphic)

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

    For $i = 0 To 2
    $matrix[$i] = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixTranslate($matrix[$i], $width/2, $height/2)
    _GDIPlus_MatrixRotate($matrix[$i], 0)
    _GDIPlus_GraphicsSetTransform($backbuffer[$i], $matrix[$i])
    $backbuffer[$i] = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($backbuffer[$i], 4)
    Next

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

    $pen[0] = _GDIPlus_PenCreate($Colour, 10)

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

    $ScreenDc = _WinAPI_GetDC($hWnd)
    $dc = _WinAPI_CreateCompatibleDC($ScreenDc)

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

    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", $width)
    DllStructSetData($tSize, "Y", $height)
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", 255)
    DllStructSetData($tBlend, "Format", 1)
    $tPoint = DllStructCreate($tagPOINT)
    $pPoint = DllStructGetPtr($tPoint)
    DllStructSetData($tPoint, "X", 0)
    DllStructSetData($tPoint, "Y", 0)

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

    $hFormat = _GDIPlus_StringFormatCreate()
    $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    $hFont = _GDIPlus_FontCreate($hFamily, 9, 0, 2)
    $tLayout = _GDIPlus_RectFCreate(20, 25, 110, 155)
    EndFunc

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

    Func _Close()
    For $i = 0 To 2
    _GDIPlus_GraphicsDispose($backbuffer[$i])
    _GDIPlus_MatrixDispose($matrix[$i])
    Next
    _WinAPI_ReleaseDC($hWnd, $ScreenDc)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
    Exit
    EndFunc

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

    Func _Win_SetClickThrough($hGUI, $noclic = True)
    Local $hWnd = WinGetHandle(WinGetTitle($hGUI), "")
    If @error Then Return SetError(1,0,0)
    If $noclic Then
    _WinAPI_SetWindowLong($hWnd,0xFFFFFFEC,BitOR(_WinAPI_GetWindowLong($hWnd,0xFFFFFFEC),0x00000020))
    If @error Then Return SetError(2,0,0)
    Else
    _WinAPI_SetWindowLong($hWnd,0xFFFFFFEC,BitAND(_WinAPI_GetWindowLong($hWnd,0xFFFFFFEC),BitNOT(0x00000020)))
    If @error Then Return SetError(2,0,0)
    EndIf
    Return 1
    EndFunc

    [/autoit]

    Ist zwar nichts besonderes, aber ich habs trotzdem mal reingestellt.

    Mit den Tasten Numpad + / - könnt ihr die Geschwindigkeit erhöhen, bzw. senken.

  • GDI+ Notitzzettel

    • Nestos
    • 6. März 2010 um 09:06

    Ja der Befehl war mir auch klar, nur wusste ich nicht ob ich das mit einem Button oder sonstigem einbinden sollte.

    Trotzdem Danke. ;)

  • Run!

    • Nestos
    • 2. März 2010 um 18:20

    Edit: Ups. Sehr schönes Spiel. ;)

    Edit2: Und ich hätt schon gedacht, ich hab mich verschaut. ^^'

  • GDI+ Schlangenlinien

    • Nestos
    • 28. Februar 2010 um 11:04

    Ist dir wirklich gut gelungen.

    Habs mal ein bisschen modifiziert.
    Hoffe du bist mir deswegen nicht böse. ;)

    In Zeile 78 kannst du einstellen, ob die Schlangenlinien nach und nach verschwinden sollen.

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <GDIPlus.au3>

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

    Opt("GUIOnEventMode", 1)

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

    Global $hGUI, _ ;Handle zu dem Hauptfenster
    $VectorX, _
    $VectorY

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

    Global $hGraphics, _ ;Graphikobjekt zum zeichnen
    $hBitmap, _ ;Bitmapobjekt
    $backbuffer, _ ;Buffer, in den alles hineingezeichnet wird, damit es Flüssiger aussieht
    $hPen, _ ;Pinselobjekt zum Zeichnen der Schlangenlinien
    $brush ;transparenter Pinsel, zum Überzeichnen der Schlangenlinien

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

    Global $GUIWidth = 400, _ ;Breite des Fensters
    $GUIHeight = 400, _ ;Höhe des Fensters
    $Size = 5, _ ;Durchmesser des Kreises der die einzelnen Bögen vervollständigt
    $PenSize = 1, _ ;Randstärke der Linie
    $Angle = Random(0, 3, 1) * 90, _ ;Startwinkel (Gültige Werte: 0°, 90°, 180°, 270°)
    $iX = Random($Size, $GUIWidth / $Size - $Size, 1) * $Size, _ ;X-Startkoordinate
    $iY = Random($Size, $GUIHeight / $Size - $Size, 1) * $Size, _ ;Y-Startkoordinate
    $GUIColorBG = 0x10FFFFFF, _ ;Hintergrundfarbe der GUI
    $LineColor = 0xFF000000, _ ;Farbe der geschlängelten Linie
    $RandomFactor = 40, _ ;Wahrscheinlichkeit eines Richtungswechsels (1 zu...)
    $Switch180 = 180

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

    If $Angle = 0 Then
    $VectorX = $Size
    $VectorY = 0
    ElseIf $Angle = 90 Then
    $VectorX = 0
    $VectorY = $Size
    ElseIf $Angle = 180 Then
    $VectorX = $Size * - 1
    $VectorY = 0
    ElseIf $Angle = 270 Then
    $VectorX = 0
    $VectorY = $Size * - 1
    EndIf

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

    $hGUI = GUICreate("Schlangenlinien", 400, 400)
    GUISetBkColor(0xFFFFFF)
    GUISetOnEvent(-3, "_Close")
    GUISetState()

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

    _Startup()

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

    AdlibRegister("_DrawArc", 10)

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

    While 1
    Sleep(1000)
    WEnd

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

    Func _Startup()
    _GDIPlus_Startup()

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

    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($GUIWidth, $GUIHeight, $hGraphics)
    $backbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 4)

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

    $hPen = _GDIPlus_PenCreate($LineColor, $PenSize)
    $brush = _GDIPlus_BrushCreateSolid(0x05FFFFFF)
    EndFunc

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

    Func _Close()
    _GDIPlus_BrushDispose($brush)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    Exit
    EndFunc

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

    Func _DrawArc()
    ;~ _GDIPlus_GraphicsFillRect($backbuffer, 0, 0, $GUIWidth, $GUIHeight, $brush)
    If Random(1, 40, 1) = 1 Then
    _ChangeDirection()
    EndIf
    If $iX >= $GUIWidth - $Size * 2 And $Angle = 0 And $iY < $GUIHeight / 2 Then
    _GDIPlus_GraphicsDrawEllipse($backbuffer, $iX, $iY, $Size, $Size, $hPen)
    $VectorX = 0
    $VectorY = $Size
    $Angle = 90
    EndIf
    If $iX >= $GUIWidth - $Size * 2 And $Angle = 0 And $iY >= $GUIHeight / 2 Then
    _GDIPlus_GraphicsDrawEllipse($backbuffer, $iX, $iY, $Size, $Size, $hPen)
    $VectorX = 0
    $VectorY = $Size * - 1
    $Angle = 270
    EndIf
    If $iX <= 0 And $Angle = 180 And $iY < $GUIHeight / 2 Then
    _GDIPlus_GraphicsDrawEllipse($backbuffer, $iX, $iY, $Size, $Size, $hPen)
    $VectorX = 0
    $VectorY = $Size
    $Angle = 90
    EndIf
    If $iX <= 0 And $Angle = 180 And $iY >= $GUIHeight / 2 Then
    _GDIPlus_GraphicsDrawEllipse($backbuffer, $iX, $iY, $Size, $Size, $hPen)
    $VectorX = 0
    $VectorY = $Size * - 1
    $Angle = 270
    EndIf
    If $iY >= $GUIHeight - $Size * 2 And $Angle = 90 And $iX < $GUIWidth / 2 Then
    _GDIPlus_GraphicsDrawEllipse($backbuffer, $iX, $iY, $Size, $Size, $hPen)
    $VectorX = $Size
    $VectorY = 0
    $Angle = 0
    EndIf
    If $iY >= $GUIHeight - $Size * 2 And $Angle = 90 And $iX >= $GUIWidth / 2 Then
    _GDIPlus_GraphicsDrawEllipse($backbuffer, $iX, $iY, $Size, $Size, $hPen)
    $VectorX = $Size * - 1
    $VectorY = 0
    $Angle = 180
    EndIf
    If $iY <= 0 And $Angle = 270 And $iX < $GUIHeight / 2 Then
    _GDIPlus_GraphicsDrawEllipse($backbuffer, $iX, $iY, $Size, $Size, $hPen)
    $VectorX = $Size
    $VectorY = 0
    $Angle = 0
    EndIf
    If $iY <= 0 And $Angle = 270 And $iX >= $GUIHeight / 2 Then
    _GDIPlus_GraphicsDrawEllipse($backbuffer, $iX, $iY, $Size, $Size, $hPen)
    $VectorX = $Size * - 1
    $VectorY = 0
    $Angle = 180
    EndIf
    $iX += $VectorX
    $iY += $VectorY
    $Switch180 *= -1
    _GDIPlus_GraphicsDrawArc($backbuffer, $iX, $iY, $Size, $Size, $Angle, $Switch180, $hPen)
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $GUIWidth, $GUIHeight) ; Das Zeichnen hat im Buffer stattgefunden. Damit das Ganze sichtbar wird, wird das Ganze in das Graphikobjekt kopiert
    EndFunc ;==>_DrawArc

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

    Func _ChangeDirection()
    If $Angle = 0 Or $Angle = 180 Then
    If Random(0, 1, 1) = 1 Then
    $Angle = 90
    Else
    $Angle = 270
    EndIf
    ElseIf $Angle = 90 Or $Angle = 270 Then
    If Random(0, 1, 1) = 1 Then
    $Angle = 0
    Else
    $Angle = 180
    EndIf
    EndIf
    If $iX >= $GUIWidth - $Size * 2 Then $Angle = 180
    If $iY >= $GUIHeight - $Size * 2 Then $Angle = 270
    If $iX <= 0 Then $Angle = 0
    If $iY <= 0 Then $Angle = 90
    If $Angle = 0 Then
    $VectorX = $Size
    $VectorY = 0
    ElseIf $Angle = 90 Then
    $VectorX = 0
    $VectorY = $Size
    ElseIf $Angle = 180 Then
    $VectorX = $Size * - 1
    $VectorY = 0
    ElseIf $Angle = 270 Then
    $VectorX = 0
    $VectorY = $Size * - 1
    EndIf
    _GDIPlus_GraphicsDrawEllipse($backbuffer, $iX, $iY, $Size, $Size, $hPen)
    EndFunc ;==>_ChangeDirection

    [/autoit]
  • GDI+ Notitzzettel

    • Nestos
    • 25. Februar 2010 um 19:32

    Danke für die Rückmeldungen, ich werd mich bemühen eure wünsche schnellstmöglich umzusetzen. :)

    Edit:
    - Rechtschreibfehler beseitigt. - Zacharja
    - Editfeld direkt über den Zettel gelegt. - Idee von UEZ
    - X zum schließen hinzugefügt.

  • GDI+ Notitzzettel

    • Nestos
    • 24. Februar 2010 um 21:29

    Ich hatte die letzte Stunde Langeweile, und so ist ein Notitzzettel herausgekommen, der ausschließlich mit GDI+ gezeichnet wird.

    Ist zwar nichts besonderes, aber vieleicht hilft es jemandem, der sich noch nicht so gut mit GDI+ auskennt. :)

    Das ganze wird per Traymenü gesteuert.

    Kretik ist gerne gesehen. ;)

    Edit:
    - Rechtschreibfehler beseitigt. - Zacharja
    - Editfeld direkt über den Zettel gelegt. - Idee von UEZ
    - X zum schließen hinzugefügt.

    Wie ich die Fontauswahl einbinden könnte, weiß ich noch nicht so genau, bin aber am überlegen.

    GDI+ Notitzzettel
    [autoit]

    #include <GDIPlus.au3>
    #include <Misc.au3>

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

    HotKeySet("{ESC}", "_Close")

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

    Opt("GUIOnEventMode", 1)

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

    Global $hWnd, $EditGUI, $Edit, $hGraphic, $hBitmap, $backbuffer, $brush1, $brush2, $pen1, $pen2, $pen3, $hFormat, $hFamily, $hFont, $tLayout, $aInfo
    Global $ScreenDc, $dc, $tSize, $pSize, $tSource, $pSource, $tBlend, $pBlend, $tPoint, $pPoint, $gdibitmap
    Global $title = "Notizzettel", _
    $user32 = DllOpen("user32.dll"), _
    $width = 150, _
    $height = 200

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

    Global $notice = "Durch drücken und ziehen des Eselohrs, können Sie die Fensterposition ändern. " & @CRLF & @CRLF & _
    "Wenn Sie die Notiz ändern wollen, klicken Sie auf die bereits vorhandene Notiz. " & @CRLF & @CRLF & _
    "Um den Notizzettel zu schließen, klicken Sie auf das rote X. "

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

    Global $WinPos[4], $MousePos[2]

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

    Global $points[6][2]

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

    $points[0][0] = 5
    $points[1][0] = 0
    $points[1][1] = 20
    $points[2][0] = 20
    $points[2][1] = 0
    $points[3][0] = 149
    $points[3][1] = 0
    $points[4][0] = 149
    $points[4][1] = 199
    $points[5][0] = 0
    $points[5][1] = 199

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

    $hWnd = GUICreate($title, $width, $height, -1, -1, 0x80000000, BitOR(0x00000080, 0x00080000, 0x00000008))

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

    _Startup()

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

    _DrawSheet()

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

    GUISetState(@SW_SHOW, $hWnd)

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

    $EditGUI = GuiCreate($title & " Edit", 110, 155, -1, -1, BitOr(0x80000000, 0x00000200), BitOR(0x00000080, 0x00000008))
    $Edit = GUICtrlCreateEdit($notice, 0, 0, 110, 155, BitOR(0x1000, 0x0004, 0x0040), 0x00000204)

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

    GUISetState(@SW_HIDE, $EditGUI)

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

    While 1
    If _IsPressed("01") And WinActive($hWnd) Then
    $WinPos = WinGetPos($hWnd)
    $MousePos = MouseGetPos()
    If $MousePos[0] >= $WinPos[0] And $MousePos[0] <= $WinPos[0] + 20 And $MousePos[1] >= $WinPos[1] And $MousePos[1] <= $WinPos[1] + 20 Then
    GUISetState(@SW_HIDE, $EditGUI)
    MouseMove($WinPos[0] + 10, $WinPos[1] + 10, 0)
    GUISetCursor(9, 1, $hWnd)
    While _IsPressed("01")
    $MousePos = MouseGetPos()
    WinMove($hWnd, "", $MousePos[0] - 10, $MousePos[1] - 10)
    WEnd
    GUISetCursor(2, 0, $hWnd)
    ElseIf $MousePos[0] >= $WinPos[0] + 20 And $MousePos[0] <= $WinPos[0] + 130 And $MousePos[1] >= $WinPos[1] + 25 And $MousePos[1] <= $WinPos[1] + 185 Then
    WinMove($EditGUI, "", $WinPos[0] + 20, $WinPos[1] + 25)
    GUISetState(@SW_SHOW, $EditGUI)
    ElseIf $MousePos[0] >= $WinPos[0] + 135 And $MousePos[0] <= $WinPos[0] + 145 And $MousePos[1] >= $WinPos[1] + 5 And $MousePos[1] <= $WinPos[1] + 15 Then
    _Close()
    Else
    GUISetState(@SW_HIDE, $EditGUI)
    EndIf
    EndIf
    If _IsPressed("0D") And _IsPressed("11") And WinActive($EditGUI) Then
    $notice = GUICtrlRead($Edit)
    GUISetState(@SW_HIDE, $EditGUI)
    _DrawSheet()
    EndIf
    Sleep(10)
    WEnd

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

    Func _Startup()
    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $hGraphic)
    $backbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 4)

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

    $brush1 = _GDIPlus_BrushCreateSolid(0xFFF8F8FF)
    $brush2 = _GDIPlus_BrushCreateSolid()
    $pen1 = _GDIPlus_PenCreate(0xFF4169E1)
    $pen2 = _GDIPlus_PenCreate(0x224169E1)
    $pen3 = _GDIPlus_PenCreate(0xFFFF0000, 2)

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

    $ScreenDc = _WinAPI_GetDC($hWnd)
    $dc = _WinAPI_CreateCompatibleDC($ScreenDc)

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

    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", $width)
    DllStructSetData($tSize, "Y", $height)
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", 255)
    DllStructSetData($tBlend, "Format", 1)
    $tPoint = DllStructCreate($tagPOINT)
    $pPoint = DllStructGetPtr($tPoint)
    DllStructSetData($tPoint, "X", 0)
    DllStructSetData($tPoint, "Y", 0)

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

    $hFormat = _GDIPlus_StringFormatCreate()
    $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    $hFont = _GDIPlus_FontCreate($hFamily, 9, 0, 2)
    $tLayout = _GDIPlus_RectFCreate(20, 25, 110, 155)
    EndFunc

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

    Func _Close()
    GUISetState(@SW_MINIMIZE, $hWnd)
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
    DllClose($user32)
    Exit
    EndFunc

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

    Func _DrawSheet()
    _GDIPlus_GraphicsFillPolygon($backbuffer, $points, $brush1)

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

    _GDIPlus_GraphicsDrawPolygon($backbuffer, $points, $pen1)

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

    _GDIPlus_GraphicsDrawLine($backbuffer, $points[1][0], $points[1][1], 20, 20, $pen1)
    _GDIPlus_GraphicsDrawLine($backbuffer, 20, 20, $points[2][0], $points[2][1], $pen1)

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

    _GDIPlus_GraphicsDrawLine($backbuffer, 4, 16, 4, 199, $pen2)
    _GDIPlus_GraphicsDrawLine($backbuffer, 9, 12, 9, 199, $pen2)
    _GDIPlus_GraphicsDrawLine($backbuffer, 14, 6, 14, 199, $pen2)

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

    For $i = 19 To $width Step +5
    _GDIPlus_GraphicsDrawLine($backbuffer, $i, 0, $i, 199, $pen2)
    Next

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

    _GDIPlus_GraphicsDrawLine($backbuffer, 16, 4, 149, 4, $pen2)
    _GDIPlus_GraphicsDrawLine($backbuffer, 12, 9, 149, 9, $pen2)
    _GDIPlus_GraphicsDrawLine($backbuffer, 5, 14, 149, 14, $pen2)

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

    For $i = 19 To $height Step +5
    _GDIPlus_GraphicsDrawLine($backbuffer, 0, $i, 149, $i, $pen2)
    Next

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

    _GDIPlus_GraphicsDrawLine($backbuffer, 135, 5, 145, 15, $pen3)
    _GDIPlus_GraphicsDrawLine($backbuffer, 135, 15, 145, 5, $pen3)

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

    $aInfo = _GDIPlus_GraphicsMeasureString($backbuffer, $notice, $hFont, $tLayout, $hFormat)
    _GDIPlus_GraphicsDrawStringEx($backbuffer, $notice, $hFont, $aInfo[0], $hFormat, $brush2)

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

    $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
    _WinAPI_SelectObject($dc, $gdibitmap)
    _WinAPI_UpdateLayeredWindow($hWnd, $ScreenDc, 0, $pSize, $dc, $pSource, 0, $pBlend, 2)
    _WinAPI_DeleteObject($gdibitmap)
    EndFunc

    [/autoit]
  • Lautstärke

    • Nestos
    • 23. Februar 2010 um 15:07
    Zitat von Detroit49

    ja habe ich und es geht alles
    P.s das ist ja nur ein kleiner teil

    Wer lesen kann, ist klar im Vorteil.

    Zeig uns halt mal dein gesamtes Script, damit wir dir besser helfen können. :)

  • Geilste Fehlermeldung^^ !!UPDATE!!

    • Nestos
    • 21. Februar 2010 um 11:52

    Ach du scheiße. xD

  • LED - Laufschrift

    • Nestos
    • 21. Februar 2010 um 09:08

    Wow, das ist jetzt wirklich schnell und vorallem CPU schonend.
    Ich hatte gradmal 1% Auslastung. ;)

  • _GDIPlus_GraphicsReflectImageRect

    • Nestos
    • 15. Februar 2010 um 14:57

    Bei mir läuft das Script eigentlich auch einwandfrei.

    Windows XP Home Edition, Service Pack 3

  • Forum funktioniert nicht mehr richtig bei mir...

    • Nestos
    • 11. Februar 2010 um 20:11

    Ich hab den ganzen Schnickschnack überhaupt nicht. o.o

    Bei mir ist da überhaupt nur ein weißes Editfeld. :/

  • Physik Engine Version2

    • Nestos
    • 9. Februar 2010 um 12:46

    Wirklich super gemacht, alle Achtung. ;)

  • Smooth WinSetSize

    • Nestos
    • 8. Februar 2010 um 18:37

    Mit dem Style $WS_EX_COMPOSITED schaut das ganze flüssiger aus. ;)

    Aber wirklich nette Funktion!

  • Schnitzel hat Geburtstag

    • Nestos
    • 6. Februar 2010 um 11:43

    Und auch von mir alles Gute. ;)

    :thumbup:

  • _GDIPlus_GraphicsReflectImageRect

    • Nestos
    • 4. Februar 2010 um 19:16

    Hatte heute Langeweile und ein GDI+ Beispiel mit Spiegeleffekt und abfallender Transparents geschrieben.

    Danksagungen gehen natürlich an:
    Siao, Malkey (für die super Funktion) und GTA Spider, von dem ich das Bild 'missbraucht' hab.
    Hoffe, du hast nichts dagegen. ;)

    Edit:
    So, hab das Script umgeschrieben und das ganze zu einen Mausverfolger ummodeliert. Sozusagen als Beispiel.
    Den Mausverfolger kann man mit esc und linken strg Taste ausschschalten.

    Einstellbare Einrückung pro Zeile nach links hinzugefügt.

    Die Funktion selbst ist nun auch Universeller.

    ACHTUNG: Der Parameter $dheight sollte besser mit -1 übergeben werden, weil da noch ein Bug drinnen ist.
    Bin noch am Basteln. ;)

    Screenshot:
    [Blockierte Grafik: http://img697.imageshack.us/img697/7633/gd…icsreflecti.png]

    Beispiel
    [autoit]

    #NoTrayIcon
    #include <GDIPlus.au3>
    #include <Misc.au3>

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

    Opt("GUIOnEventMode", 1)

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

    Global $hWnd, $hGraphic, $hBitmap, $backbuffer, $hImage
    Global $ScreenDc, $dc, $tSize, $pSize, $tSource, $pSource, $tBlend, $pBlend, $tPoint, $pPoint, $gdibitmap
    Global $title = "GDI+ Beispiel: Bilder spiegeln", _
    $user32 = DllOpen("user32.dll"), _
    $width = 500, _
    $height = 130

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

    Global $reflect, $MousePos

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

    If Not FileExists(@ScriptDir & "\autoit_logo_gtaspider.png") Then FileInstall("D:\_bnt8x-dta\Eigene Dateien\Eigene Bilder\AutoIt.de Logo\autoit_logo_gtaspider.png", @ScriptDir & "\autoit_logo_gtaspider.png")

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

    $hWnd = GUICreate($title, $width, $height, -1, -1, 0x80000000, BitOR(0x00000080, 0x00080000, 0x00000008))

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

    _Startup()
    _GDIPlus_GraphicsClear($backbuffer, 0x00000000)
    _GDIPlus_GraphicsDrawImageRect($backbuffer, $hImage, 16, 0, 468, 60)
    _GDIPlus_GraphicsReflectImageRect($backbuffer, $hImage, 16, 70, -1, 40, 0.7)
    $reflect = _GDIPlus_BitmapCloneArea($backbuffer, 0, 0, 700, 700, $GDIP_PXF64PARGB)
    $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
    _WinAPI_SelectObject($dc, $gdibitmap)
    _WinAPI_UpdateLayeredWindow($hWnd, $ScreenDc, 0, $pSize, $dc, $pSource, 0, $pBlend, 2)
    _WinAPI_DeleteObject($gdibitmap)
    _GDIClose()

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

    GUISetState()

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

    While 1
    $MousePos = MouseGetPos()
    WinMove($title, "", $MousePos[0], $MousePos[1])
    If _IsPressed("1B", $user32) And _IsPressed("A2", $user32) Then _Close()
    Sleep(10)
    WEnd

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

    Func _Startup()
    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $hGraphic)
    $backbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 4)
    $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\autoit_logo_gtaspider.png")

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

    $ScreenDc = _WinAPI_GetDC($hWnd)
    $dc = _WinAPI_CreateCompatibleDC($ScreenDc)

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

    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", $width)
    DllStructSetData($tSize, "Y", $height)
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", 255)
    DllStructSetData($tBlend, "Format", 1)
    $tPoint = DllStructCreate($tagPOINT)
    $pPoint = DllStructGetPtr($tPoint)
    DllStructSetData($tPoint, "X", 0)
    DllStructSetData($tPoint, "Y", 0)
    EndFunc

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

    Func _GDIClose()
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
    If @Compiled Then FileDelete(@ScriptDir & "\autoit_logo_gtaspider.png")
    EndFunc

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

    Func _Close()
    DllClose($user32)
    GUISetState(@SW_MINIMIZE, $hWnd)
    Exit
    EndFunc

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

    ; #FUNCTION# ==========================================================================================================
    ; Name...........: _GDIPlus_GraphicsReflectImageRect
    ; Description ...: Spiegelt ein Bildobjekt mit abfallender Transparents und einstellbarer Schräge.
    ; Syntax.........: _GDIPlus_GraphicsReflectImageRect($hGraphic, $hImage, $xpos, $ypos, [$dwidth, [$dheight, [$divx]]])
    ; Parameters ....: $hGraphics - Handle zu einem Graphicobjekt
    ; $hImage - Handle zu einem Bildobjekt
    ; $xpos - Die X Koordinate des Startzeichenpunktes
    ; $ypos - Die Y Koordinate des Startzeichenpunktes
    ; $dwidth - Breite des zu zeichnenden Bildes
    ; $dheight - Höhe des zu zeichnenden Bildes (!FEHLERHAFT)
    ; $divx - Die Anzahl der Pixel, die pro Zeile nach links eingerückt werden
    ; Return values .: Success - True
    ; Failure - @error
    ; Author ........: h2112
    ; Remarks .......: Die Funktion _GDIPlus_GraphicsDrawImageRectRectTrans wird benötigt
    ;======================================================================================================================
    Func _GDIPlus_GraphicsReflectImageRect($hGraphic, $hImage, $xpos, $ypos, $dwidth = -1, $dheight = -1, $divx = 0.7)
    Local $height, $width, $clone, $stat, $check
    Local $divy, $divtrans, $trans, $x, $y, $olddivy

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

    $height = _GDIPlus_ImageGetHeight($hImage)
    $width = _GDIPlus_ImageGetWidth($hImage)

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

    If $dheight = -1 Then $dheight = $height
    If $dwidth = -1 Then $dwidth = $width

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

    $divtrans = 255 / $height
    $divy = $dheight / $height

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

    For $i = $height To 0 Step -1
    $trans = 1 / 255 * $divtrans * $i
    $x = $divx * ($height - $i)
    $y = $divy * ($height - $i)
    If Int($y) <> Int($divy) * ($height - $i) + $stat Then
    $stat += 1
    $check = 1
    $olddivy = $divy
    $divy += Int($y) - Int($divy) * ($height - $i) + $stat
    EndIf
    $clone = _GDIPlus_BitmapCloneArea($hImage, 0, $i, $width, 1, $GDIP_PXF64PARGB)
    _GDIPlus_GraphicsDrawImageRectRectTrans($hGraphic, $clone, 0, 0, $width, $height, $xpos - $x, $y + $ypos, $dwidth, $divy, "", $trans)
    If $check = 1 Then
    $divy = $olddivy
    $check = 0
    EndIf
    Next
    If Not @error Then
    Return True
    Else
    Return @error
    EndIf
    EndFunc

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

    ; #FUNCTION# ===================================================================================================
    ; Name...........: _GDIPlus_GraphicsDrawImageRectRectTrans
    ; Description ...: Draw an Image object with transparency
    ; Syntax.........: _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hImage, $iSrcX, $iSrcY, [$iSrcWidth, _
    ; [$iSrcHeight, [$iDstX, [$iDstY, [$iDstWidth, [$iDstHeight[, [$iUnit = 2]]]]]]])
    ; Parameters ....: $hGraphics - Handle to a Graphics object
    ; $hImage - Handle to an Image object
    ; $iSrcX - The X coordinate of the upper left corner of the source image
    ; $iSrcY - The Y coordinate of the upper left corner of the source image
    ; $iSrcWidth - Width of the source image
    ; $iSrcHeight - Height of the source image
    ; $iDstX - The X coordinate of the upper left corner of the destination image
    ; $iDstY - The Y coordinate of the upper left corner of the destination image
    ; $iDstWidth - Width of the destination image
    ; $iDstHeight - Height of the destination image
    ; $iUnit - Specifies the unit of measure for the image
    ; $nTrans - Value range from 0 (Zero for invisible) to 1.0 (fully opaque)
    ; Return values .: Success - True
    ; Failure - False
    ; Author ........: Siao
    ; Modified.......: Malkey
    ; Remarks .......:
    ; Related .......:
    ; Link ..........; http://www.autoitscript.com/forum/index.ph…ndpost&p=517195
    ; Example .......; Yes
    Func _GDIPlus_GraphicsDrawImageRectRectTrans($hGraphics, $hImage, $iSrcX, $iSrcY, $iSrcWidth = "", $iSrcHeight = "", _
    $iDstX = "", $iDstY = "", $iDstWidth = "" , $iDstHeight = "", $iUnit = 2, $nTrans = 1)
    Local $tColorMatrix, $x, $hImgAttrib, $iW = _GDIPlus_ImageGetWidth($hImage), $iH = _GDIPlus_ImageGetHeight($hImage)
    If $iSrcWidth = 0 or $iSrcWidth = "" Then $iSrcWidth = $iW
    If $iSrcHeight = 0 or $iSrcHeight = "" Then $iSrcHeight = $iH
    If $iDstX = "" Then $iDstX = $iSrcX
    If $iDstY = "" Then $iDstY = $iSrcY
    If $iDstWidth = "" Then $iDstWidth = $iSrcWidth
    If $iDstHeight = "" Then $iDstHeight = $iSrcHeight
    If $iUnit = "" Then $iUnit = 2
    ;;create color matrix data
    $tColorMatrix = DllStructCreate("float[5];float[5];float[5];float[5];float[5]")
    ;blending values:
    $x = DllStructSetData($tColorMatrix, 1, 1, 1) * DllStructSetData($tColorMatrix, 2, 1, 2) * DllStructSetData($tColorMatrix, 3, 1, 3) * _
    DllStructSetData($tColorMatrix, 4, $nTrans, 4) * DllStructSetData($tColorMatrix, 5, 1, 5)
    ;;create an image attributes object and update its color matrix
    $hImgAttrib = DllCall($ghGDIPDll, "int", "GdipCreateImageAttributes", "ptr*", 0)
    $hImgAttrib = $hImgAttrib[1]
    DllCall($ghGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, _
    "int", 1, "ptr", DllStructGetPtr($tColorMatrix), "ptr", 0, "int", 0)
    ;;draw image into graphic object with alpha blend
    DllCall($ghGDIPDll, "int", "GdipDrawImageRectRectI", "hwnd", $hGraphics, "hwnd", $hImage, "int", $iDstX, "int", _
    $iDstY, "int", $iDstWidth, "int", $iDstHeight, "int", $iSrcX, "int", $iSrcY, "int", $iSrcWidth, "int", _
    $iSrcHeight, "int", $iUnit, "ptr", $hImgAttrib, "int", 0, "int", 0)
    ;;clean up
    DllCall($ghGDIPDll, "int", "GdipDisposeImageAttributes", "ptr", $hImgAttrib)
    Return
    EndFunc ;==>_GDIPlus_GraphicsDrawImageRectRectTrans

    [/autoit]
    _GDIPlus_GraphicsReflectImageRect
    [autoit]

    ; #FUNCTION# ==========================================================================================================
    ; Name...........: _GDIPlus_GraphicsReflectImageRect
    ; Description ...: Spiegelt ein Bildobjekt mit abfallender Transparents und einstellbarer Schräge.
    ; Syntax.........: _GDIPlus_GraphicsReflectImageRect($hGraphic, $hImage, $xpos, $ypos, [$dwidth, [$dheight, [$divx]]])
    ; Parameters ....: $hGraphics - Handle zu einem Graphicobjekt
    ; $hImage - Handle zu einem Bildobjekt
    ; $xpos - Die X Koordinate des Startzeichenpunktes
    ; $ypos - Die Y Koordinate des Startzeichenpunkt; #FUNCTION# ==========================================================================================================
    ; Name...........: _GDIPlus_GraphicsReflectImageRect
    ; Description ...: Spiegelt ein Bildobjekt mit abfallender Transparents und einstellbarer Schräge.
    ; Syntax.........: _GDIPlus_GraphicsReflectImageRect($hGraphic, $hImage, $xpos, $ypos, [$dwidth, [$dheight, [$divx]]])
    ; Parameters ....: $hGraphics - Handle zu einem Graphicobjekt
    ; $hImage - Handle zu einem Bildobjekt
    ; $xpos - Die X Koordinate des Startzeichenpunktes
    ; $ypos - Die Y Koordinate des Startzeichenpunktes
    ; $dwidth - Breite des zu zeichnenden Bildes
    ; $dheight - Höhe des zu zeichnenden Bildes (!FEHLERHAFT)
    ; $divx - Die Anzahl der Pixel, die pro Zeile nach links eingerückt werden
    ; Return values .: Success - True
    ; Failure - @error
    ; Author ........: h2112
    ; Remarks .......: Die Funktion _GDIPlus_GraphicsDrawImageRectRectTrans wird benötigt
    ;======================================================================================================================
    Func _GDIPlus_GraphicsReflectImageRect($hGraphic, $hImage, $xpos, $ypos, $dwidth = -1, $dheight = -1, $divx = 0.7)
    Local $height, $width, $clone, $stat, $check
    Local $divy, $divtrans, $trans, $x, $y, $olddivy

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

    $height = _GDIPlus_ImageGetHeight($hImage)
    $width = _GDIPlus_ImageGetWidth($hImage)

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

    If $dheight = -1 Then $dheight = $height
    If $dwidth = -1 Then $dwidth = $width

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

    $divtrans = 255 / $height
    $divy = $dheight / $height

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

    For $i = $height To 0 Step -1
    $trans = 1 / 255 * $divtrans * $i
    $x = $divx * ($height - $i)
    $y = $divy * ($height - $i)
    If Int($y) <> Int($divy) * ($height - $i) + $stat Then
    $stat += 1
    $check = 1
    $olddivy = $divy
    $divy += Int($y) - Int($divy) * ($height - $i) + $stat
    EndIf
    $clone = _GDIPlus_BitmapCloneArea($hImage, 0, $i, $width, 1, $GDIP_PXF64PARGB)
    _GDIPlus_GraphicsDrawImageRectRectTrans($hGraphic, $clone, 0, 0, $width, $height, $xpos - $x, $y + $ypos, $dwidth, $divy, "", $trans)
    If $check = 1 Then
    $divy = $olddivy
    $check = 0
    EndIf
    Next
    If Not @error Then
    Return True
    Else
    Return @error
    EndIf
    EndFunc

    [/autoit]

    Bild, au3 und exe sind im Anhang.

    Dateien

    Mausverfolger.zip 547,07 kB – 384 Downloads
  • IntelliSenseBox

    • Nestos
    • 4. Februar 2010 um 17:16

    Wirklich gut gemacht.

    Drei kleine Fehler hab ich trotzdem entdeckt:

    1. Wenn man nichts markiert hat, und trotzdem Enter drückt, wird 0 in das Input geschrieben.
    2. Das Fenster, welches du erstellst, wird in der Taskleiste angezeigt.
    3. Wenn man etwas in die Box reinschreibt, dies dann aber wieder löscht, ist die Box trotzdem noch da.

    Sind zwar nicht wirklich Fehler, hab sie trotzdem behoben. Ich hoffe, du bist mir nicht böse. ;)

    Spoiler anzeigen
    [autoit]

    #include<GUIConstantsEx.au3>
    #include<ListBoxConstants.au3>
    #include <WindowsConstants.au3>
    #include <GUIListBox.au3>
    #Include <WinAPI.au3>
    #include <Misc.au3>
    Opt("GUICloseOnESC", 0)

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

    #region - Deklarationen für Sense
    Global $show = False
    Global $indexB = -1
    Global $SenseGui, $SenseCtrl, $guiBox, $box
    Global $POSSenseGui[2]
    #Region Box
    ; Hier die Auswahldaten (braucht nicht sortiert sein):
    Global $aData[10] = ['Birne','Alligator','Auto','Dank','Automat','Bett','Garten','Bettler','Danke','Danksagung']
    $guiBox = GUICreate('', 150, 85, 0, 0, BitOR($WS_SIZEBOX, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
    $box = _GUICtrlListBox_Create($guiBox, '', 0, 0, 150, 86, BitOR($LBS_SORT, 0x00B00002))
    ; ListBox muß 1 Pixel höher als GUI sein - sonst fehlerhafte Darstellung
    For $i = 0 To UBound($aData) -1 ; falls Daten mit _FileReadToArray gelesen werden: StartIndex=1
    _GUICtrlListBox_AddString($box, $aData[$i])
    Next
    #EndRegion Box
    GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
    GUIRegisterMsg($WM_MOVE, "_WM_MOVE")
    GUIRegisterMsg(0x231, "_WM_ENTERSIZEMOVE")
    #EndRegion - Deklarationen Sense

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

    #Region Main
    $Form1 = GUICreate('Intelli Sense Box', 400, 300, 200, 50)
    $SenseGui = $Form1 ; <== Für Allgemeingültigkeit Zuweisung an $SenseGui
    $Input = GUICtrlCreateInput('', 10, 10, 380, 21)
    $SenseCtrl = $Input ; <== Für Allgemeingültigkeit Zuweisung an $SenseCtrl
    $hInput = GUICtrlGetHandle($Input)
    GUISetState()
    #EndRegion Main

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

    While True
    _ChooseBox()
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
    WEnd

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

    #region - SenseFuncs
    Func _ChooseBox()
    If Not $show Or ControlGetText($SenseGui, '', $SenseCtrl) = "" Then
    GUISetState(@SW_HIDE, $guiBox)
    $show = False
    Return
    EndIf
    If _IsPressed('0D') Then ; ENTER
    If _GUICtrlListBox_GetText($box, $indexB) <> 0 Then
    ControlSetText($SenseGui, '', $SenseCtrl, _GUICtrlListBox_GetText($box, $indexB))
    EndIf
    GUISetState(@SW_HIDE, $guiBox)
    $show = False
    ElseIf _IsPressed('1B') Then ; ESC
    GUISetState(@SW_HIDE, $guiBox)
    $show = False
    ElseIf _IsPressed('26') Then ; UP
    If $indexB > 0 Then
    $indexB -= 1
    _GUICtrlListBox_SetCurSel($box, $indexB)
    Sleep(90)
    EndIf
    ElseIf _IsPressed('28') Then ; DOWN
    If $indexB < _GUICtrlListBox_GetCount($box)-1 Then
    $indexB += 1
    _GUICtrlListBox_SetCurSel($box, $indexB)
    Sleep(90)
    EndIf
    EndIf
    EndFunc

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

    Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    Local $nNotifyCode = BitShift($wParam, 16)
    Local $hCtrl = $lParam
    Local $hSenseCtrl = $SenseCtrl
    If Not IsHWnd($hSenseCtrl) Then $hSenseCtrl = GUICtrlGetHandle($hSenseCtrl)
    If ($nNotifyCode = 1024 Or $nNotifyCode = 6) And $hCtrl = $hSenseCtrl Then
    Local $str = ControlGetText($SenseGui, '', $SenseCtrl)
    $indexB = _GUICtrlListBox_FindString($box, $str)
    _GUICtrlListBox_SetCurSel($box, $indexB)
    $caret = _CaretPos()
    If Not @error And Not $show Then
    If $caret[3] + $caret[4] - 95 < 0 Then ; Platz für Liste über dem Ctrl ausreichend?
    WinMove($guiBox, '', $caret[0], $caret[1] +25) ; Versatz 25 (Ctrlhöhe+5) unter y vom Ctrl
    Else
    WinMove($guiBox, '', $caret[0], $caret[1] -95) ; Versatz 95 (Boxhöhe+10) über y vom Ctrl
    EndIf
    GUISetState(@SW_SHOWNOACTIVATE, $guiBox)
    $show = True
    EndIf
    ElseIf $hCtrl = $box And $nNotifyCode = 1 Then
    $indexB = _GUICtrlListBox_GetCurSel($box)
    ControlSetText($SenseGui, '', $SenseCtrl, _GUICtrlListBox_GetText($box, $indexB))
    GUISetState(@SW_HIDE, $guiBox)
    $show = False
    ElseIf $show And $nNotifyCode = 512 And $hCtrl = $lParam And Not $hCtrl = $box Then
    GUISetState(@SW_HIDE,$guiBox)
    $show = False
    EndIf
    Return $GUI_RUNDEFMSG
    EndFunc

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

    Func _WM_ENTERSIZEMOVE($hWnd)
    If $hWnd = $SenseGui Then $POSSenseGui = WinGetPos($SenseGui)
    EndFunc

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

    Func _WM_MOVE($hWnd)
    If $hWnd = $SenseGui Then
    Local $pos = WinGetPos($guiBox)
    Local $postemp = WinGetPos($SenseGui)
    WinMove($guiBox,"",$pos[0]-($POSSenseGui[0]-$postemp[0]),$pos[1]-($POSSenseGui[1]-$postemp[1]))
    $POSSenseGui = WinGetPos($SenseGui)
    EndIf
    EndFunc

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

    Func _CaretPos()
    Local $old = Opt("CaretCoordMode", 0) ;relative mode
    Local $c = WinGetCaretPos() ;relative caret coords
    Local $w = WinGetPos("") ;window's coords
    Local $f = ControlGetFocus("","") ;text region "handle"
    Local $e = ControlGetPos("", "", $f) ;text region coords
    Local $h = ControlGetHandle("", "", $f) ;Ctrl-Handle
    Local $t[5]
    If IsArray($c) and IsArray($w) and IsArray($e) Then
    If _WinAPI_IsClassName($SenseCtrl, 'Edit') Then ; Input wird als Edit-Class erkannt
    $t[0] = $c[0] + $w[0] + $e[0]
    ElseIf _WinAPI_IsClassName($SenseCtrl, 'ComboBox') Then
    $t[0] = $w[0] + $e[0]
    EndIf
    $t[1] = $c[1] + $w[1] + $e[1]
    $t[2] = $h
    $t[3] = $w[1]
    $t[4] = $e[1]
    Opt("CaretCoordMode", $old)
    Return $t ;absolute screen coords of caret cursor
    Else
    Opt("CaretCoordMode", $old)
    SetError(1)
    EndIf
    EndFunc
    #endregion - SenseFuncs

    [/autoit]
  • QDesktop

    • Nestos
    • 4. Januar 2010 um 10:51

    Bei mir wird das Fenster, mit dem man die Programme starten kann, garnicht angezeigt.

    Zudem bekomm ich lauter Warnungen, weil du in Funktionen Global deklaiert hast:

    Spoiler anzeigen
    Code
    >"C:\Programme\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "D:\_bnt8x-dta\Eigene Dateien\_Exe, zip, rar files\QDesktop\QDesktop\qdesktop.au3" /autoit3dir "C:\Programme\AutoIt3" /UserParams    
    +>10:41:19 Starting AutoIt3Wrapper v.2.0.0.1    Environment(Language:0407  Keyboard:00000407  OS:WIN_XP/Service Pack 3  CPU:X64 OS:X86)
    >Running AU3Check (1.54.14.0)  from:C:\Programme\AutoIt3
    D:\_bnt8x-dta\Eigene Dateien\_Exe, zip, rar files\QDesktop\QDesktop\qdesktop.au3(286,29) : WARNING: $Loading_GUI_Startup: possibly used before declaration.
    winmove($Loading_GUI_Startup,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    D:\_bnt8x-dta\Eigene Dateien\_Exe, zip, rar files\QDesktop\QDesktop\qdesktop.au3(286,48) : WARNING: $width: possibly used before declaration.
    winmove($Loading_GUI_Startup,"",$pos[0]-($width/
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    D:\_bnt8x-dta\Eigene Dateien\_Exe, zip, rar files\QDesktop\QDesktop\qdesktop.au3(286,69) : WARNING: $height: possibly used before declaration.
    winmove($Loading_GUI_Startup,"",$pos[0]-($width/2), $pos[1]-($height/
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    D:\_bnt8x-dta\Eigene Dateien\_Exe, zip, rar files\QDesktop\QDesktop\qdesktop.au3(287,32) : WARNING: $Oben_Quickstart_Button: possibly used before declaration.
    winmove($Oben_Quickstart_Button,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    D:\_bnt8x-dta\Eigene Dateien\_Exe, zip, rar files\QDesktop\QDesktop\qdesktop.au3(288,33) : WARNING: $Unten_Quickstart_Button: possibly used before declaration.
    winmove($Unten_Quickstart_Button,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    D:\_bnt8x-dta\Eigene Dateien\_Exe, zip, rar files\QDesktop\QDesktop\qdesktop.au3(289,33) : WARNING: $Links_Quickstart_Button: possibly used before declaration.
    winmove($Links_Quickstart_Button,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    D:\_bnt8x-dta\Eigene Dateien\_Exe, zip, rar files\QDesktop\QDesktop\qdesktop.au3(290,34) : WARNING: $Rechts_Quickstart_Button: possibly used before declaration.
    winmove($Rechts_Quickstart_Button,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    D:\_bnt8x-dta\Eigene Dateien\_Exe, zip, rar files\QDesktop\QDesktop\qdesktop.au3(419,40) : WARNING: $hImage: possibly used before declaration.
    SetBitmap($Loading_GUI_Startup, $hImage,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    D:\_bnt8x-dta\Eigene Dateien\_Exe, zip, rar files\QDesktop\QDesktop\qdesktop.au3(420,44) : WARNING: $hImage1: possibly used before declaration.
    SetBitmap($Oben_Quickstart_Button, $hImage1,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    D:\_bnt8x-dta\Eigene Dateien\_Exe, zip, rar files\QDesktop\QDesktop\qdesktop.au3(421,45) : WARNING: $hImage2: possibly used before declaration.
    SetBitmap($Unten_Quickstart_Button, $hImage2,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    D:\_bnt8x-dta\Eigene Dateien\_Exe, zip, rar files\QDesktop\QDesktop\qdesktop.au3(422,45) : WARNING: $hImage3: possibly used before declaration.
    SetBitmap($Links_Quickstart_Button, $hImage3,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    D:\_bnt8x-dta\Eigene Dateien\_Exe, zip, rar files\QDesktop\QDesktop\qdesktop.au3(423,46) : WARNING: $hImage4: possibly used before declaration.
    SetBitmap($Rechts_Quickstart_Button, $hImage4,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    D:\_bnt8x-dta\Eigene Dateien\_Exe, zip, rar files\QDesktop\QDesktop\qdesktop.au3(306,53) : WARNING: $hImage: declared global in function only. Prefer top of file.
    Global $hImage = _GDIPlus_ImageLoadFromFile($pngSrc)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    D:\_bnt8x-dta\Eigene Dateien\_Exe, zip, rar files\QDesktop\QDesktop\qdesktop.au3 - 0 error(s), 13 warning(s)
    ->10:41:20 AU3Check ended.rc:1
    Alles anzeigen

    Ansonsten scheint es mir ein schönes Programm zu sein, wieter so. ;)

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™