Screenshot Problem

  • Hallo,

    dieser Code erstellt einen Screenshot.
    Leider mit Rahmen der Gui.

    Wie kann ich nur das Bild erhalten?


    Spoiler anzeigen
    [autoit]


    #cs ----------------------------------------------------------------------------

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

    AutoIt Version: 3.3.6.1
    Author: myName

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

    Script Function:
    Template AutoIt script.

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

    #ce ----------------------------------------------------------------------------
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <ScreenCapture.au3>
    #include <WindowsConstants.au3>
    $Form1 = GUICreate("Form1", 503, 445, 192, 124)
    $Name = GUICtrlCreateLabel("Name", 24, 312, 32, 17)
    $Input1 = GUICtrlCreateInput("Input1", 72, 312, 121, 21)
    $Level = GUICtrlCreateLabel("Level", 312, 312, 30, 17)
    $Input2 = GUICtrlCreateInput("Input2", 352, 312, 129, 21)
    $Ok = GUICtrlCreateButton("Ok", 216, 352, 75, 25, $WS_GROUP)
    $Bild = GUICtrlCreateButton("Bild", 72, 408, 99, 25, $WS_GROUP)
    $Beenden = GUICtrlCreateButton("Beenden", 368, 408, 75, 25, $WS_GROUP)
    $Pic1 = GUICtrlCreatePic(@ScriptDir&"\augen.jpg", 0, 0, 500, 300, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Ok
    GUICtrlCreateLabel(GUICtrlRead($Input1), 256, 32, 234, 46)
    GUICtrlSetBkColor(-1, -2)
    GUICtrlCreateLabel(GUICtrlRead($Input2), 232, 184, 252, 43)
    GUICtrlSetBkColor(-1, -2)
    Case $Bild
    GUISetState(@SW_HIDE)
    $Form1_1 = GUICreate("Form1", 503, 301, 192, 124)
    $Pic1 = GUICtrlCreatePic(@ScriptDir&"\augen.jpg", 0, 0, 500, 300, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
    $Label1 = GUICtrlCreateLabel(GUICtrlRead($Input1), 256, 32, 82, 46)
    GUICtrlSetBkColor(-1, -2)
    $eeee = GUICtrlCreateLabel(GUICtrlRead($Input2), 232, 184, 52, 43)
    GUICtrlSetBkColor(-1, -2)
    GUISetState(@SW_SHOW)
    _ScreenCapture_CaptureWnd(@ScriptDir & "\Screenshot.jpg", $Form1_1, 0, 0, -1, -1, true)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

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

    EndSwitch
    WEnd
    EndSwitch
    WEnd

    [/autoit]

    Grüße
    ;) Ilse

    3 Mal editiert, zuletzt von Ilse (18. Juli 2012 um 16:58)

  • $WS_POPUP

    Was soll eigentlich die zweite While-Schleife???? ?(

    Achja und ich würde die krummen Pixelwerte ändern, die durch Koda verursacht wurden.

  • Guten Morgen m-obi,

    schön daß du dich meldest.

    Habe $WS_POPUP eingebaut.
    Aber der Screenshot ist immer noch mit Rahmen.
    Und... es wird ein Screenshot vom Hintergrund gemacht.

    So, als ob die Gui nicht den Fokus hat!

    Spoiler anzeigen
    [autoit]


    #cs ----------------------------------------------------------------------------

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

    AutoIt Version: 3.3.6.1
    Author: myName

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

    Script Function:
    Template AutoIt script.

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

    #ce ----------------------------------------------------------------------------
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <ScreenCapture.au3>
    #include <WindowsConstants.au3>
    $Form1 = GUICreate("Form1", 503, 445, 192, 124,$WS_POPUP) ; hier POPUP eingebaut
    $Name = GUICtrlCreateLabel("Name", 24, 312, 32, 17)
    $Input1 = GUICtrlCreateInput("Input1", 72, 312, 121, 21)
    $Level = GUICtrlCreateLabel("Level", 312, 312, 30, 17)
    $Input2 = GUICtrlCreateInput("Input2", 352, 312, 129, 21)
    $Ok = GUICtrlCreateButton("Ok", 216, 352, 75, 25, $WS_GROUP)
    $Bild = GUICtrlCreateButton("Bild", 72, 408, 99, 25, $WS_GROUP)
    $Beenden = GUICtrlCreateButton("Beenden", 368, 408, 75, 25, $WS_GROUP)
    $Pic1 = GUICtrlCreatePic(@ScriptDir&"\augen.jpg", 0, 0, 500, 300, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Ok
    GUICtrlCreateLabel(GUICtrlRead($Input1), 256, 32, 234, 46)
    GUICtrlSetBkColor(-1, -2)
    GUICtrlSetFont(-1, 16, 800, 0, "Arial")
    GUICtrlCreateLabel(GUICtrlRead($Input2), 232, 184, 252, 43)
    GUICtrlSetFont(-1, 16, 800, 0, "Arial")
    GUICtrlSetBkColor(-1, -2)
    Case $Bild
    GUISetState(@SW_HIDE)
    $Form1_1 = GUICreate("Form1", 503, 301, 192, 124)
    $Pic1 = GUICtrlCreatePic(@ScriptDir&"\augen.jpg", 0, 0, 500, 300, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
    $Label1 = GUICtrlCreateLabel(GUICtrlRead($Input1), 256, 32, 82, 46)

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

    GUICtrlSetBkColor(-1, -2)
    $eeee = GUICtrlCreateLabel(GUICtrlRead($Input2), 232, 184, 52, 43)
    GUICtrlSetFont(-1, 16, 800, 0, "Arial")
    GUICtrlSetBkColor(-1, -2)
    GUISetState(@SW_SHOW)
    _ScreenCapture_CaptureWnd(@ScriptDir & "\Screenshot.jpg", $Form1_1, 0, 0, -1, -1, true)

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

    EndSwitch
    WEnd

    [/autoit]

    :( Grüße Ilse

  • Hallo m-obi,

    wie kann man die krummen Oixelwerte ändern?

    Hier mal mit Änderungen:

    Spoiler anzeigen
    [autoit]


    #cs ----------------------------------------------------------------------------

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

    AutoIt Version: 3.3.6.1
    Author: myName

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

    Script Function:
    Template AutoIt script.

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

    #ce ----------------------------------------------------------------------------
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <ScreenCapture.au3>
    #include <WindowsConstants.au3>
    $Form1 = GUICreate("Form1", 503, 445, 192, 124)
    $Name = GUICtrlCreateLabel("Name", 24, 312, 32, 17)
    $Input1 = GUICtrlCreateInput("Input1", 72, 312, 121, 21)
    $Level = GUICtrlCreateLabel("Level", 312, 312, 30, 17)
    $Input2 = GUICtrlCreateInput("Input2", 352, 312, 129, 21)
    $Ok = GUICtrlCreateButton("Ok", 216, 352, 75, 25, $WS_GROUP)
    $Bild = GUICtrlCreateButton("Bild", 72, 408, 99, 25, $WS_GROUP)
    $Beenden = GUICtrlCreateButton("Beenden", 368, 408, 75, 25, $WS_GROUP)
    $Pic1 = GUICtrlCreatePic(@ScriptDir&"\augen.jpg", 0, 0, 500, 300, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Ok
    GUICtrlCreateLabel(GUICtrlRead($Input1), 256, 32, 234, 46)
    GUICtrlSetBkColor(-1, -2)
    GUICtrlSetFont(-1, 16, 800, 0, "Arial")
    GUICtrlCreateLabel(GUICtrlRead($Input2), 232, 184, 252, 43)
    GUICtrlSetFont(-1, 16, 800, 0, "Arial")
    GUICtrlSetBkColor(-1, -2)
    Case $Bild
    GUISetState(@SW_HIDE)
    $Form1_1 = GUICreate("Form1", 503, 301, 192, 124,$WS_POPUP)
    $Pic1 = GUICtrlCreatePic(@ScriptDir&"\augen.jpg", 0, 0, 500, 300, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
    $Label1 = GUICtrlCreateLabel(GUICtrlRead($Input1), 256, 32, 82, 46)

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

    GUICtrlSetBkColor(-1, -2)
    $eeee = GUICtrlCreateLabel(GUICtrlRead($Input2), 232, 184, 52, 43)
    GUICtrlSetFont(-1, 16, 800, 0, "Arial")
    GUICtrlSetBkColor(-1, -2)
    GUISetState(@SW_SHOW)
    _ScreenCapture_CaptureWnd(@ScriptDir & "\Screenshot.jpg", $Form1_1, 0, 0, -1, -1, true)
    Sleep(2000)

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

    GUIDelete($Form1_1)
    GUISwitch($Form1)
    GUISetState(@SW_SHOW)

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

    EndSwitch
    WEnd

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

    Aber der Screenshot sieht so aus:
    autoit.de/wcf/attachment/15972/

  • Ich habe folgendes vor:

    aber soweit bin ich noch nicht. Da es hier schon wieder Fehler gibt,

    1. Ich habe einen Ordner mit Bildern.
    2. Auf jedes Bild soll dann Text drauf

    Also die Bilder sollen eingelesen werden und mit dem Text dann abgespeichert werden.
    Ich dachte da an Screenshots.

    Aber vielleicht liege ich da ja falsch.

    huh...

    Liebe Grüße
    Ilse ;)

  • Das geht am besten mit GDI+. Nicht mit solchen Fusch mit Screenshots. Musst mal suchen. UEZ hatte mal sowas gemacht.

  • Merci für den Hinweis,

    hab was gefunden und angepasst.
    Aber das Bild ist ohne Text.

    Bin noch nicht dahintergekommen wieso.

    Spoiler anzeigen
    [autoit]


    ; Quelle: UEZ
    #include <GDIPlus.au3>

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

    _GDIPlus_Startup()
    ;Local $hBild = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\source\img001.jpg")
    Local $hBild = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\augen.jpg")
    Local $iX = _GDIPlus_ImageGetWidth($hBild)
    Local $iY = _GDIPlus_ImageGetHeight($hBild)

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

    Local $text = "Das ist der Text auf dem Bild"

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

    Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iX, $iY)
    Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hContext, 2)

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

    Local $hPinsel = _GDIPlus_BrushCreateSolid (0xFFFFFFFF)
    Local $hFormat = _GDIPlus_StringFormatCreate ()
    Local $hFamily = _GDIPlus_FontFamilyCreate ("English")
    Local $font_size = Floor(($iX - StringLen($text)) / 20)
    Local $hFont = _GDIPlus_FontCreate ($hFamily, $font_size, 0)
    Local $tLayout = _GDIPlus_RectFCreate (0, 0, 0, 0)
    Local $aInfo = _GDIPlus_GraphicsMeasureString ($hContext, $text, $hFont, $tLayout, $hFormat)

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

    _GDIPlus_GraphicsDrawImageRect($hContext, $hBild, 0, 0, $iX, $iY)

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

    Local $fWidth = DllStructGetData($aInfo[0], "Width")
    Local $fHeight = DllStructGetData($aInfo[0], "Height")

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

    DllStructSetData($tLayout, "x", $iX / 2 - Round($fWidth / 2, 0))
    DllStructSetData($tLayout, "y", $iY / 2 - Round($fHeight / 2, 0) - 2)

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

    _GDIPlus_GraphicsDrawStringEx ($hContext, $text, $hFont, $tLayout, $hFormat, $hPinsel)

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

    _Exit()

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

    Func _Exit()
    ;_GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\ready\img001.jpg")
    _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\Augen-mit-Text.jpg")
    _GDIPlus_ImageDispose($hBild)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hPinsel)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hContext)
    _GDIPlus_Shutdown()
    Exit
    EndFunc

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

    Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iStride = 0, $iPixelFormat = 0x0026200A, $pScan0 = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[6]
    EndFunc

    [/autoit]

    :( Grüße Ilse

  • muß mich wieder melden.

    Ich habe da nochwas von UEZ gefunden

    Funktioniert prima. Text in Zwischenablage und Bild mit Text wird angezeigt.

    ABER: Wie kann ich das angezeigte in einem Ordner speichern?
    GDIPlus habe ich noch keine Erfahrung

    Spoiler anzeigen
    [autoit]


    #include <GDIPlus.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include "Write Text on Bitmap.au3"
    $iFile = FileOpenDialog("Select an Image", "", "Image (*.jpg;*.bmp;*.png;*gif)")
    If @error Then Exit

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

    _GDIPlus_Startup()
    ;Local $hImage = WTOB($iFile, "Dies ist ein Test", "Comic Sans MS", 11, -1, -1, 2, 2)
    Local $hImage = WTOB($iFile, Clipget(), "Arial", 40, 200, 200, 2, 2)
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hImage = ' & $hImage & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console

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

    Local $iWidth = _GDIPlus_ImageGetWidth($hImage)
    Local $iHeight = _GDIPlus_ImageGetHeight($hImage)
    Local $hGUI = GUICreate("GDI+ Write Text on Bitmap by UEZ 2010", $iWidth, $iHeight, -1, -1, $WS_POPUP)
    GUISetState()

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

    Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 0, 0, $iWidth, $iHeight)

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

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

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

    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()

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

    Exit

    [/autoit]

    Diese Datei braucht man
    autoit.de/wcf/attachment/15973/

  • Hallo $Var,

    super das klappt.
    Eine GDI Frage noch:

    Wie kann man die Schriftattribute ändern?
    Hab das in der Hilfe gefunden

    [autoit]


    $hFormat = _GDIPlus_StringFormatCreate()
    $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    $hFont = _GDIPlus_FontCreate($hFamily, 12, 2)
    $tLayout = _GDIPlus_RectFCreate(140, 110, 100, 20)

    [/autoit]

    Wenn ich z.B. diese Zeile habe

    [autoit]


    Local $hImage = WTOB($iFile, Clipget(), "Arial", 40, 200, 200, 2, 2)

    [/autoit]

    Wo finde ich, daß die Schrift z.B. rot, blau...ausgefüllt wird?
    Bin in der Hilfe noch nicht so ganz durchgestiegen...

    Gibt es vielleicht irgendwo ein GDIPlus Tutorial?

    :( Grüße Ilse

  • Probiere mal diese Funktion aus. Damit kann man so ziemlich alles relevante einstellen:

    _GDIPlus_GraphicsDrawStringCustom
    [autoit]

    ; #FUNCTION# ===================================================================
    ; Name ..........: _GDIPlus_GraphicsDrawStringCustom
    ; Description ...: Draw a customized string
    ; AutoIt Version : v3.3.6.1
    ; Syntax ........: _GDIPlus_GraphicsDrawStringCustom ($h_Graphics, $s_String, $i_X, $i_Y, $n_Size, $b_Color[, $i_Align = 0[, $i_Weight = 0[, $s_Font = 'Tahoma']]])
    ; Parameter(s): .: $h_Graphics - Handle to a Graphics object
    ; $s_String - String to be drawn
    ; $i_X - X coordinate where the string will be drawn
    ; $i_Y - Y coordinate where the string will be drawn
    ; $n_Size - Font size to use for drawing
    ; $b_Color - Alpha, Red, Green and Blue components
    ; $i_Align - The alignment can be one of the following:
    ; |0 - The text is aligned to the left
    ; |1 - The text is centered
    ; |2 - The text is aligned to the right
    ; $i_Weight - The style of the typeface. Can be a combination of the following:
    ; |0 - Normal weight or thickness of the typeface
    ; |1 - Bold typeface
    ; |2 - Italic typeface
    ; |4 - Underline
    ; |8 - Strikethrough
    ; $s_Font - Name of the Font Family
    ; Return Value ..: Success - True
    ; Failure - False
    ; Author(s) .....: $var
    ; ==============================================================================
    Func _GDIPlus_GraphicsDrawStringCustom ($h_Graphics, $s_String, $i_X, $i_Y, $n_Size, $b_Color, $i_Align = 0, $i_Weight = 0, $s_Font = 'Tahoma')
    Local $a_CreateSolidFill, $a_CreateStringFormat, $a_CreateFontFamilyFromName, $a_CreateFont, $t_Struct, $p_Layout, $a_Return
    $a_CreateSolidFill = DllCall ($ghGDIPDll, 'int', 'GdipCreateSolidFill', 'int', $b_Color, 'dword*', 0)
    $a_CreateStringFormat = DllCall ($ghGDIPDll, 'int', 'GdipCreateStringFormat', 'int', 0, 'word', 0, 'ptr*', 0)
    $a_CreateFontFamilyFromName = DllCall ($ghGDIPDll, 'int', 'GdipCreateFontFamilyFromName', 'wstr', $s_Font, 'ptr', 0, 'handle*', 0)
    $a_CreateFont = DllCall ($ghGDIPDll, 'int', 'GdipCreateFont', 'handle', $a_CreateFontFamilyFromName[3], 'float', $n_Size, 'int', $i_Weight, 'int', 3, 'ptr*', 0)
    $t_Struct = DllStructCreate ($tagGDIPRECTF)
    $p_Layout = DllStructGetPtr ($t_Struct)
    DllStructSetData ($t_Struct, 'X', $i_X)
    DllStructSetData ($t_Struct, 'Y', $i_Y)
    DllStructSetData ($t_Struct, 'Width', 0)
    DllStructSetData ($t_Struct, 'Height', 0)
    DllCall ($ghGDIPDll, 'int', 'GdipSetStringFormatAlign', 'handle', $a_CreateStringFormat[3], 'int', $i_Align)
    $a_Return = DllCall ($ghGDIPDll, 'int', 'GdipDrawString', 'handle', $h_Graphics, 'wstr', $s_String, 'int', -1, 'handle', $a_CreateFont[5], _
    'ptr', $p_Layout, 'handle', $a_CreateStringFormat[3], 'handle', $a_CreateSolidFill[2])
    Return $a_Return[0] = 0
    EndFunc ;==> _GDIPlus_GraphicsDrawStringCustom

    [/autoit]

    €: Tutorial

  • Hallo $Var,

    merci für deine Hilfe!
    Und den GDI Link...

    Naja, sieht alles mächtig aus...ich melde mich dann nächstes Jahr wieder. ;)

    Mach mich gleich dran und arbeite mich mal rein.

    Vielen Dank

    Liebe Grüße
    Ilse ;)

  • Hallo $Var,

    noch kurz ne Frage:

    Die Funktion verwirrt mich noch etwas:
    Wo genau muß ich was ändern?

    [autoit]


    ; $s_Font - Name of the Font Family

    [/autoit]

    Muß ich das aktivieren? Oder die Zeile in die Funktion einbauen?

    [autoit]


    $s_Font = "Arial"

    [/autoit]

    ?( Ilse

  • Hmn :/ >> Vllt. sollte jemand mal erklären wie das mit den Funktionen geht ^^

    Du musst den Wert ersezen. Ich weiß jetzt nicht ganz auf welche Funktion du dich Beziehst. Gehen wir mal davon aus x)))

    _Funktions_Name($parameter_1, $Parameter_2, $s_Font)

    Nur mal als Beispiel!!!


    Nun musst du die Werte in der Klammer ersetzen, genauso wie Befehle:

    _Funktions_Name(1, 1, "Arial")


    Hoffentlich öffnet dir das Simple Beispiel die Augen ^^

  • Letzendlich sind UDF's, bzw. einzelne Funktionen, nichts anderes als so etwas wie GUICreate($sTitle,$iWidth,$iHeight).
    Hier ersetzt du $sTitle durch den Titel des Fensters, $iWidth durch die Breite der GUI und $iHeight durch die Höhe der GUI.
    Also wird aus:

    [autoit]


    GUICreate($sTitle,$iWidth,$iHeight)

    [/autoit]


    Das hier:

    [autoit]


    GUICreate("Test-GUI",250,250)

    [/autoit]


    Oder das hier: ;)

    [autoit]


    Local $sTest = "Test-GUI"
    Local $iWidth = 250
    Local $iHeight = 250
    GUICreate($sTitle,$iWidth,$iHeight)

    [/autoit]

    lg chess

    Edit: Jetzt hast du's gleich doppelt. :rofl:

  • Hallo,

    danke für die Info!

    Also ich meinte diese Funktion von $Var

    Spoiler anzeigen
    [autoit]


    ; #FUNCTION# ===================================================================
    ; Name ..........: _GDIPlus_GraphicsDrawStringCustom
    ; Description ...: Draw a customized string
    ; AutoIt Version : v3.3.6.1
    ; Syntax ........: _GDIPlus_GraphicsDrawStringCustom ($h_Graphics, $s_String, $i_X, $i_Y, $n_Size, $b_Color[, $i_Align = 0[, $i_Weight = 0[, $s_Font = 'Tahoma']]])
    ; Parameter(s): .: $h_Graphics - Handle to a Graphics object
    ; $s_String - String to be drawn
    ; $i_X - X coordinate where the string will be drawn
    ; $i_Y - Y coordinate where the string will be drawn
    ; $n_Size - Font size to use for drawing
    ; $b_Color - Alpha, Red, Green and Blue components
    ; $i_Align - The alignment can be one of the following:
    ; |0 - The text is aligned to the left
    ; |1 - The text is centered
    ; |2 - The text is aligned to the right
    ; $i_Weight - The style of the typeface. Can be a combination of the following:
    ; |0 - Normal weight or thickness of the typeface
    ; |1 - Bold typeface
    ; |2 - Italic typeface
    ; |4 - Underline
    ; |8 - Strikethrough
    ; $s_Font - Name of the Font Family
    ; Return Value ..: Success - True
    ; Failure - False
    ; Author(s) .....: $var
    ; ==============================================================================
    Func _GDIPlus_GraphicsDrawStringCustom ($h_Graphics, $s_String, $i_X, $i_Y, $n_Size, $b_Color, $i_Align = 0, $i_Weight = 0, $s_Font = 'Tahoma')
    Local $a_CreateSolidFill, $a_CreateStringFormat, $a_CreateFontFamilyFromName, $a_CreateFont, $t_Struct, $p_Layout, $a_Return
    $a_CreateSolidFill = DllCall ($ghGDIPDll, 'int', 'GdipCreateSolidFill', 'int', $b_Color, 'dword*', 0)
    $a_CreateStringFormat = DllCall ($ghGDIPDll, 'int', 'GdipCreateStringFormat', 'int', 0, 'word', 0, 'ptr*', 0)
    $a_CreateFontFamilyFromName = DllCall ($ghGDIPDll, 'int', 'GdipCreateFontFamilyFromName', 'wstr', $s_Font, 'ptr', 0, 'handle*', 0)
    $a_CreateFont = DllCall ($ghGDIPDll, 'int', 'GdipCreateFont', 'handle', $a_CreateFontFamilyFromName[3], 'float', $n_Size, 'int', $i_Weight, 'int', 3, 'ptr*', 0)
    $t_Struct = DllStructCreate ($tagGDIPRECTF)
    $p_Layout = DllStructGetPtr ($t_Struct)
    DllStructSetData ($t_Struct, 'X', $i_X)
    DllStructSetData ($t_Struct, 'Y', $i_Y)
    DllStructSetData ($t_Struct, 'Width', 0)
    DllStructSetData ($t_Struct, 'Height', 0)
    DllCall ($ghGDIPDll, 'int', 'GdipSetStringFormatAlign', 'handle', $a_CreateStringFormat[3], 'int', $i_Align)
    $a_Return = DllCall ($ghGDIPDll, 'int', 'GdipDrawString', 'handle', $h_Graphics, 'wstr', $s_String, 'int', -1, 'handle', $a_CreateFont[5], _
    'ptr', $p_Layout, 'handle', $a_CreateStringFormat[3], 'handle', $a_CreateSolidFill[2])
    Return $a_Return[0] = 0
    EndFunc ;==> _GDIPlus_GraphicsDrawStringCustom

    [/autoit]

    Er meinte daß man damit die Stringattribute u.v.m. einfach ändern kann.
    Und meine Frage war, was ich an der Func ändern muß?

    Wenn ich z.B. die Schriftart und Größe ändern will
    was muß ich da an der Funktion ändern?


    ?( Grüße Ilse

  • Steht doch alles in der Beschreibung ?(

    [autoit]

    ; Parameter(s): .: $h_Graphics - Handle to a Graphics object
    ; $s_String - String to be drawn
    ; $i_X - X coordinate where the string will be drawn
    ; $i_Y - Y coordinate where the string will be drawn
    ; $n_Size - Font size to use for drawing
    ; $b_Color - Alpha, Red, Green and Blue components
    ; $i_Align - The alignment can be one of the following:
    ; |0 - The text is aligned to the left
    ; |1 - The text is centered
    ; |2 - The text is aligned to the right
    ; $i_Weight - The style of the typeface. Can be a combination of the following:
    ; |0 - Normal weight or thickness of the typeface
    ; |1 - Bold typeface
    ; |2 - Italic typeface
    ; |4 - Underline
    ; |8 - Strikethrough
    ; $s_Font - Name of the Font Family

    [/autoit]
  • Hallo m-obi,

    hm... das ist mir schon klar.

    Beispiel: $nSize ändert die Größe

    [autoit]


    $n_Size - Font size to use for drawing

    [/autoit]

    OK
    Muß ich dann z.B.

    $nSize = 22
    außerhalb der Funktion Global deklarieren
    oder muß ich das in die Funktion ändern?.

    $n_Size
    ist in der Funktion drin. Muß ich den Wert 22
    z.B. so ändern

    [autoit]


    Func _GDIPlus_GraphicsDrawStringCustom ($h_Graphics, $s_String, $i_X, $i_Y, $n_Size = 22, $b_Color,

    [/autoit]


    Steh etwas auf dem Schlauch
    Muß mal ne Paue machen...

    :( Grüße Ilse