Themed ownerdrawn controls

  • Moin,

    da ja doch ab und an mal danach gefragt wird, stelle ich hier mal ein Beispielskript vor, wie man visuelle Stile in selbstgezeichneten oder -erzeugten Steuerelementen benutzen kann.

    In dem Skript setzen wir das OWNERDRAW-Flag in einer Schaltfläche und zeichnen diese mit dem aktuellen visuellen Stil (sofern visuelle Stile aktiviert sind).



    Gruß
    Greenhorn

  • Hallo Greenhorn,

    ich wollte gerade dein Skipt unter WinXP SP3 Winodws-XP - Style testen. Klappte leider nicht, Ausgabe Scite-Konsole;

    Code
    >Running:(3.3.6.1):C:\Programme\AutoIt3\autoit3.exe "C:\Programme\AutoIt3\Downloads\Greenhorn\Themed_Ownerdraw.au3"    
    C:\Programme\AutoIt3\Downloads\Greenhorn\Themed_Ownerdraw.au3 (558) : ==> Subscript used with non-Array variable.:
    Return $aRes[0]
    Return $aRes^ ERROR
    ->03:53:04 AutoIT3.exe ended.rc:1
    >Exit code: 1    Time: 4.194

    mfg autoBert

  • Hallo Greenhorn,

    ich wollte gerade dein Skipt unter WinXP SP3 Winodws-XP - Style testen. Klappte leider nicht, Ausgabe Scite-Konsole;

    Code
    >Running:(3.3.6.1):C:\Programme\AutoIt3\autoit3.exe "C:\Programme\AutoIt3\Downloads\Greenhorn\Themed_Ownerdraw.au3"    
    C:\Programme\AutoIt3\Downloads\Greenhorn\Themed_Ownerdraw.au3 (558) : ==> Subscript used with non-Array variable.:
    Return $aRes[0]
    Return $aRes^ ERROR
    ->03:53:04 AutoIT3.exe ended.rc:1
    >Exit code: 1    Time: 4.194

    mfg autoBert

    Windows 7 x86: Das gleiche.


    Hi,

    für x86 Systeme müsst ihr SetWindowLongPtr und GetWindowLongPtr ändern. ;)
    So sollte es auf beiden Architekturen laufen ...

    Spoiler anzeigen
    [autoit]


    Func GetWindowLongPtr ($hWnd, $nIndex)

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

    Local $aRes

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

    If (@OSArch == "X86") Then

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

    $aRes = DllCall ($user32dll, "LONG", "GetWindowLongW", _
    "HWND", $hWnd, _
    "INT" , $nIndex)
    Else
    $aRes = DllCall ($user32dll, "LONG_PTR", "GetWindowLongPtrW", _
    "HWND", $hWnd, _
    "INT" , $nIndex)
    EndIf

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

    Return $aRes[0]

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

    EndFunc

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

    Func SetWindowLongPtr ($hWnd, $nIndex, $dwNewLong)

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

    Local $aRes

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

    If (@OSArch == "X86") Then

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

    $aRes = DllCall ($user32dll, "LONG", "SetWindowLongW", _
    "HWND", $hWnd, _
    "INT" , $nIndex, _
    "LONG", $dwNewLong)
    Else
    $aRes = DllCall ($user32dll, "LONG_PTR", "SetWindowLongPtrW", _
    "HWND", $hWnd, _
    "INT" , $nIndex, _
    "LONG_PTR", $dwNewLong)
    EndIf

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

    Return $aRes[0]

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

    EndFunc

    [/autoit]

    Gruß
    Greenhorn