GUICtrlCreatePic mit GUICtrlSetPos vergrössern ---> Bild verpixelt Workaround?

  • Titel sagt glaub ich alles

    Scrpit ist aus der Hilfe
    hab die gössen geändert damit es besser sichtbaar ist=) und den Bild Pfad ausgeschrieben

    GUICtrlSetImage hab ich rein gemacht tut aber nix Bild ist ja schon geladen=(


    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

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

    Global $gui, $guiPos, $pic, $picPos

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

    Example1()

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

    ;----- example 1 ----
    Func Example1()
    Local $n, $msg

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

    GUICreate("My GUI picture", 350, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU) ; will create a dialog box that when displayed is centered

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

    GUISetBkColor(0xE0FFFF)
    $n = GUICtrlCreatePic("C:\Programme\AutoIt3\Examples\GUI\mslogo.jpg", 50, 50, 100, 12)

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

    GUISetState()

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

    ; Run the GUI until the dialog is closed
    While 1
    $msg = GUIGetMsg()

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

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd

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

    ; resize the control
    $n = GUICtrlSetPos($n, 50, 50, 255, 40)
    GUICtrlSetImage($n, "C:\Programme\AutoIt3\Examples\GUI\mslogo.jpg") ; keine Funktion
    ; Run the GUI until the dialog is closed
    While 1
    $msg = GUIGetMsg()

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

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd

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

    GUIDelete()
    EndFunc ;==>Example1

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

    4 Mal editiert, zuletzt von acc4iload (4. Januar 2012 um 19:04)

  • --€dit:

    Hm hab ich wohl falsch gelesen was du nun willst.(Threadtitel sagt bild verpixelt, im thread steht dsa setimage nichts macht(was es aber tat))

    Also du kannst ja das alte Bild einfach löschen und ein neues laden?

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

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

    Global $gui, $guiPos, $pic, $picPos

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

    Example1()

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

    ;----- example 1 ----
    Func Example1()
    Local $n, $msg

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

    GUICreate("My GUI picture", 350, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU) ; will create a dialog box that when displayed is centered

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

    GUISetBkColor(0xE0FFFF)
    $n = GUICtrlCreatePic("C:\Programme\AutoIt3\Examples\GUI\mslogo.jpg", 50, 50, 100, 12)

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

    GUISetState()

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

    ; Run the GUI until the dialog is closed
    While 1
    $msg = GUIGetMsg()

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

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd

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

    ; resize the control
    GUICtrlDelete($n)
    $n=GUICtrlCreatePic("C:\Programme\AutoIt3\Examples\GUI\mslogo.jpg", 50, 50, 200, 200)
    ; Run the GUI until the dialog is closed
    While 1
    $msg = GUIGetMsg()

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

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd

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

    GUIDelete()
    EndFunc ;==>Example1

    [/autoit]

    Einmal editiert, zuletzt von Death (1. Januar 2012 um 23:57)

  • Also GUICtrlSetImage hat bei mir kein sichtbaren Effekt ich hab's mehrmals probiert und auskommentiert

    Wenn ich jedoch ein neues Bild damit lade bzw. ne Kopie vom gleichen Bild dann stimmt die Auflösung

    Löschen und neu erstellen geht auch kann mir aber nicht vorstellen das es so gedacht war in der Hilfe steht:

    Zitat

    To set or change information in the control see GUICtrlUpdate....

    To update the picture after the dialog box is displayed just use GUICtrlSetImage

  • teste diese Skript:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

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

    Global $gui, $guiPos, $pic, $picPos

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

    Example1()

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

    ;----- example 1 ----
    Func Example1()
    Local $n, $msg

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

    GUICreate("My GUI picture", 350, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU) ; will create a dialog box that when displayed is centered

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

    GUISetBkColor(0xE0FFFF)
    $n = GUICtrlCreatePic("D:\Programme\AutoIt3\Examples\GUI\mslogo.jpg", 50, 50, 100, 12)

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

    GUISetState()

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

    ; Run the GUI until the dialog is closed
    While 1
    $msg = GUIGetMsg()

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

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd

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

    ; resize the control
    GUICtrlSetPos($n, 50, 50, 200, 24) ;<================ damt hast du dir die Controlid überschrieben auch das Verhältnis Höhe/Breite hat nicht mehr gestimmt.
    GUICtrlSetImage($n, "D:\Programme\AutoIt3\Examples\GUI\mslogo.jpg") ; keine Funktion
    ; Run the GUI until the dialog is closed
    While 1
    $msg = GUIGetMsg()

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

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd

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

    GUIDelete()
    EndFunc ;==>Example1

    [/autoit]

    die Pfade zum Bild musst du anpassen,

    Frohes neues Jahr

    autoBert

  • 8o das wars nur die zeichen "$n =" gelöscht und es tut wie es soll :rock: dank dir autoBert

    im Beispiel Script zu GUICtrlCreatePic

    sollte man das eventuell ändern..
    ab Zeile 28

    [autoit]


    ; resize the control
    $n = GUICtrlSetPos($n, 50, 50, 200, 100)

    [/autoit]

    ersetzten durch

    [autoit]


    ; resize the control
    GUICtrlSetPos($n, 50, 50, 255, 40)
    GUICtrlSetImage($n, "..\GUI\mslogo.jpg")

    [/autoit]
  • :cursing::cursing::cursing: ich verzweifle jetzt hab ich schon wider das gleiche Problem

    [autoit]

    #include <WindowsConstants.au3>
    #include <GDIPlus.au3>

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

    Opt("GUIOnEventMode", 1)

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

    GUICreate("My GUI picture", 350, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU)
    $n = GUICtrlCreatePic("C:\Programme\AutoIt3\Examples\GUI\mslogo.jpg", 50, 50, 100, 12)
    GUICtrlSetOnEvent($n, "big")
    GUISetState()

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

    Func Big()
    _GDIPlus_Startup() ; diese Zeile auskomentieren

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

    ;$AlbumArtWidth = 255 ;diese beiden einfügen
    ;$AlbumArtHeight = 40 ;dann gehts

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

    $hGDIPlusAlbumArtBitmap = _GDIPlus_BitmapCreateFromFile("C:\Programme\AutoIt3\Examples\GUI\mslogo.jpg")
    $AlbumArtWidth = _GDIPlus_ImageGetWidth($hGDIPlusAlbumArtBitmap)
    $AlbumArtHeight = _GDIPlus_ImageGetHeight($hGDIPlusAlbumArtBitmap)
    _GDIPlus_Shutdown()

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

    GUICtrlSetPos($n, 50, 50, $AlbumArtWidth, $AlbumArtHeight)
    GUICtrlSetImage($n, "C:\Programme\AutoIt3\Examples\GUI\mslogo.jpg")
    EndFunc ;==>Big

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

    While True
    Sleep(10)
    WEnd

    [/autoit]
  • Hi,

    nicht verzweifeln, immer wieder die Doku lesen, ob man nicht irgendetwas übersehen hat.

    Bemerkungen

    Wenn das Bitmap-Objekt nicht mehr benötigt wird, ist _GDIPlus_BitmapDispose aufzurufen, um die Ressourcen wieder freizugeben


    Spoiler anzeigen
    [autoit]

    #include <GuiConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <Constants.au3>
    #include <GDIPlus.au3>

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

    _GDIPlus_Startup() ; diese Zeile auskomentieren

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

    Global $hwnd = GUICreate("My GUI picture", 350, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU)
    Global $n = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\Examples\GUI\mslogo.jpg", 50, 50, 100, 12)
    ;~ GUICtrlSetOnEvent($n, "big")
    GUISetState()

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

    While (TRUE)
    Switch (GUIGetMsg (FALSE))
    Case $n
    Big ( )
    Case $GUI_EVENT_CLOSE
    GUIDelete($hwnd)
    _GDIPlus_Shutdown ( )
    ExitLoop
    EndSwitch
    WEnd

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

    Func Big( )

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

    ;~ $AlbumArtWidth = 255 ;diese beiden einfügen
    ;~ $AlbumArtHeight = 40 ;dann gehts

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

    $hGDIPlusAlbumArtBitmap = _GDIPlus_BitmapCreateFromFile("C:\Program Files (x86)\AutoIt3\Examples\GUI\mslogo.jpg")
    $AlbumArtWidth = _GDIPlus_ImageGetWidth($hGDIPlusAlbumArtBitmap)
    $AlbumArtHeight = _GDIPlus_ImageGetHeight($hGDIPlusAlbumArtBitmap)
    _GDIPlus_BitmapDispose ($hGDIPlusAlbumArtBitmap)

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

    GUICtrlSetPos($n, 50, 50, $AlbumArtWidth, $AlbumArtHeight)
    GUICtrlSetImage($n, "C:\Program Files (x86)\AutoIt3\Examples\GUI\mslogo.jpg")
    EndFunc ;==>Big

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

    Gruß
    Greenhorn