Scaneffekt Bild

  • Hallo Jungs und Mädels,
    habe mit GuiCtrlCreatePic ein Bild in der GUI erstellt und würde da jetzt einen sogenannten "Progressbar" drüberlaufen lassen. So eine Art Scaneffekt. Sprich von links nach rechts einen durchsichtigen, grünen Balken. Das Problem ist allerdings, ich bekomme den Balken nicht durchsichtig bei ner Graphic oder nem Label das ich drüber klatsche. Nimm ich ne zweite GUI bekomm ich die nie perfekt positioniert auf das Pic, da ja das Fenster auch mal verschoben wird, etc. Vllt. habt ihr ja ne goldene Idee.

  • Sowas?

    Spoiler anzeigen
    [autoit]

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

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

    _GDIPlus_Startup()
    Opt("GUIONEVENTMODE", 1)

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

    Global $GuiWidth = 700, $GuiHeight = 600, $sPath = @DesktopDir & "\GDIPlus_Image.jpg", $iLoadWidth = 0

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

    $hGUI = GUICreate("Scaneffekt", $GuiWidth, $GuiHeight)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
    GUISetState()

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

    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($GuiWidth, $GuiHeight, $hGraphics)
    $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    $hBrush = _GDIPlus_BrushCreateSolid(0x5000ff00)
    $hImage = _GDIPlus_ImageLoadFromFile($sPath)

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

    For $iLoadWidth = 0 To $GuiWidth Step $GuiWidth / 100
    Sleep (50)
    _GDIPlus_GraphicsDrawImageRect($hBackbuffer, $hImage, 0, 0, $GuiWidth, $GuiHeight)
    _GDIPlus_GraphicsFillRect($hBackbuffer,0, 0, $iLoadWidth, $GuiHeight, $hBrush)
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $GuiWidth, $GuiHeight)
    Next

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

    Func _exit()
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>_exit

    [/autoit]

    mfg BB

    "IF YOU'RE GOING TO KILL IT
    OPEN SOURCE IT!"

    by Phillip Torrone

    Zitat von Shoutbox

    [Heute, 11:16] Andy: ....böseböseböseböse....da erinnere ich mich daran, dass man den Puschelschwanz eines KaRnickels auch "Blume" nennt....ob da eins zum anderen passt? :rofl: :rofl: :rofl: :rofl:

    https://autoit.de/index.php?page…leIt#post251138

    Neon Snake

  • Ich wahr mit GDI+ wohl nicht Falsch :D
    Was mich persöhnlich stöhrt ist, das der *Balken* am Ende das Ganze fenster Bedeckt. Soweit ich weiss hat ein "Scanner" einen Balken mit vordefinierter Breite, oder seh ich das Falsch?

  • Hatte ich vergessen zu posten:

    Spoiler anzeigen
    [autoit]


    ;coded by UEZ 2011-03-16
    #include <GDIPlus.au3>
    Opt("GUIOnEventMode", 1)

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

    _GDIPlus_Startup ()
    $hImage = _GDIPlus_ImageLoadFromFile("..\..\Images\earth_small2.bmp")
    If Not $hImage Then
    _GDIPlus_Shutdown()
    Exit
    EndIf
    $iW = _GDIPlus_ImageGetWidth($hImage)
    $iH = _GDIPlus_ImageGetHeight($hImage)
    $hGUI = GUICreate("GDI+ Test", $iW, $iH)
    GUISetState()

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

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphic)
    $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    $hBrush = _GDIPlus_BrushCreateSolid(0)

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

    $b = 1 + Floor($iW / 5)
    $x = -$b

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

    $hScannerBitmap = _GDIPlus_BitmapCreateFromGraphics($b, $iH, $hGraphic)
    $hContext = _GDIPlus_ImageGetGraphicsContext($hScannerBitmap)
    $alpha_start = 0x04
    $alpha_end = 0xD0
    $alpha_steps = ($alpha_end - $alpha_start) / $b
    $alpha = $alpha_start

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

    For $i = 0 To $b
    $alpha += $alpha_steps
    _GDIPlus_BrushSetSolidColor($hBrush, "0x" & Hex($alpha, 2) & "00FF00")
    _GDIPlus_GraphicsFillRect($hContext, $i, 0, 1, $iH, $hBrush)
    Next
    GUISetOnEvent(-3, "_Exit")

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

    While Sleep(20)
    If Mod($x + $b, 30) < 15 Then
    WinSetTitle($hGUI, "", "Scanning ...")
    Else
    WinSetTitle($hGUI, "", "")
    EndIf
    _GDIPlus_GraphicsDrawImageRect($hBackbuffer, $hImage, 0, 0, $iW, $iH)
    _GDIPlus_GraphicsDrawImageRect($hBackbuffer, $hScannerBitmap, $x, 0, $b, $iH)
    $x += 1
    If $x > $iW + $b Then $x = -$b
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iW, $iH)
    WEnd

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

    Func _Exit()
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_BitmapDispose ($hScannerBitmap)
    _GDIPlus_BitmapDispose ($hBitmap)
    _GDIPlus_GraphicsDispose($hContext)
    _GDIPlus_GraphicsDispose($hBackbuffer)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_Shutdown()
    Exit
    EndFunc

    [/autoit]

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

    3 Mal editiert, zuletzt von UEZ (16. März 2011 um 21:55)