Screenshot Problem

  • Hier mal ein Beispiel, wie du die Funktion nutzen kannst...

    Spoiler anzeigen
    [autoit]

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

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

    _GDIPlus_Startup ()
    Opt ("GUIOnEventMode", 1)

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

    Global Const $i_WIDTH = 400, $i_HEIGHT = 200

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

    Global $h_Gui = GUICreate ("", $i_WIDTH, $i_HEIGHT)
    Global $h_Graphics = _GDIPlus_GraphicsCreateFromHWND ($h_Gui)

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

    GUISetOnEvent (-3, "_Exit", $h_Gui)
    OnAutoItExitRegister ("_OnExit")
    GUISetState (@SW_SHOW, $h_Gui)

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

    _GDIPlus_GraphicsDrawStringCustom ($h_Graphics, 'Dein String', 20, 50, 11.5, 0xFFFF0000)
    _GDIPlus_GraphicsDrawStringCustom ($h_Graphics, '_GDIPlus_GraphicsDrawStringCustom', 20, 100, 9, 0xFF333333, 0, 1, 'Arial')

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

    While Sleep (10000)
    WEnd

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

    Func _Exit ()
    Exit
    EndFunc ;==> _Exit

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

    Func _OnExit ()
    _GDIPlus_GraphicsDispose ($h_Graphics)
    _GDIPlus_Shutdown ()
    EndFunc ;==> _OnExit

    [/autoit] [autoit][/autoit] [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]
  • ok...,

    war heute ein wenig zu viel für mich.
    Ich übe mal etwas und gehe alles nochmal in Ruhe durch.

    Dank euch für die Geduld mit mir
    Ich schließe mal den Thread
    kämpfe mich durch und melde mich wieder.


    Liebe Grüße
    Ilse ;)

  • Also Ilse jetzt wirklich. Stellst du dich dumm oder bist du es. Du weißt doch wie man eine Funktion mit Parametern aufruft. Die Größe der Controls legst du doch auch über die Parameter fest. Du machst doch nicht erst seit einer Woche AutoIt.

  • m-obi,
    schon gut...

    [autoit]


    _GDIPlus_GraphicsDrawStringCustom ($h_Graphics, 'Dein String', 20, 50, 11.5, 0xFFFF0000)
    _GDIPlus_GraphicsDrawStringCustom ($h_Graphics, '_GDIPlus_GraphicsDrawStringCustom', 20, 100, 9, 0xFF333333, 0, 1, 'Arial')

    [/autoit]

    Die 2. Zeile hat mich etwas verwirrt. Ich dachte wieso wird
    '_GDIPlus_GraphicsDrawStringCustom' nochmal aufgerufen

    Daß das String wie die Func heißt hat mich aufs Glatteis geführt.

    Dein 2. String ... und der Groschen wäre gleich gefallen. So kanns gehen...

    ;) Ilse