Hi,
ich hab heute eine total blöde Frage, denn ich suche das Beispielscript von einer Function, dessen name ich vergessen hab.
Ich weiß ihn noch teilweise und habe die Hilfe schon durchsuchte, war jedoch erfolglos.
Meine Hinweise sind:
"overdrawn" "button" oder so
in dem Script steht eine Funktion drin, welches das designische klicken eines Buttons nachstellt ( dieser leichte 3D Effekt wenn mann einen Button drückt )
Hoffe auf Lösung,
Xyron
Function gesucht!
-
- [ gelöst ]
-
Xyron -
29. Mai 2010 um 21:12 -
Geschlossen -
Erledigt
-
-
Wahrscheinlich das Beispielscript zu GUIRegisterMsg?
-
Nein, ich glaube ich weiß welchen Thread Du meinst, erinnere mich aber auch nicht mehr an den Titel.
Brauchst Dich aber nicht weiter anstrengen ...
Spoiler anzeigen
[autoit]#include-once
[/autoit] [autoit][/autoit] [autoit]#include <Constants.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>OnAutoItExitRegister ("AppExit")
[/autoit] [autoit][/autoit] [autoit]; --- $DRAWITEMSTRUCT
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
Global Const $DRAWITEMSTRUCT = _
'uint CtlType;'& _
'uint CtlID;'& _
'uint itemID;'& _
'uint itemAction;'& _
'uint itemState;'& _
'hwnd hwndItem;'& _
'ptr hDC;'& _
'long rcItem[4];'& _
'ulong_ptr itemData;'Global Enum $PBS_NORMAL = 1, _
[/autoit] [autoit][/autoit] [autoit]
$PBS_HOT, _
$PBS_PRESSED, _
$PBS_DISABLED, _
$PBS_DEFAULTED, _
$PBS_DEFAULTED_ANIMATINGGlobal Const $BP_PUSHBUTTON = 1
[/autoit] [autoit][/autoit] [autoit]Global $g_hTheme
[/autoit] [autoit][/autoit] [autoit]
Global $g_hThemeLibGlobal $g_hButtonProc
[/autoit] [autoit][/autoit] [autoit]
Global $g_bMouseHover = FalseGlobal $ID_BUTTON_0
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
Global $ID_BUTTON_1;««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
[/autoit] [autoit][/autoit] [autoit]$g_hThemeLib = DllOpen ("uxtheme.dll")
[/autoit] [autoit][/autoit] [autoit]
If ($g_hThemeLib == -1) Then
ConsoleWrite ("! g_hThemeLib = "&$g_hThemeLib & @crlf)
Else
MainDlg ( )
EndIfExit (0)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]Func MainDlg ( )
[/autoit] [autoit][/autoit] [autoit]Local $hWnd
[/autoit] [autoit][/autoit] [autoit]
Local $hwndButton_1$hWnd = GUICreate ("Themed Ownerdraw Demo", 400, 300)
[/autoit] [autoit][/autoit] [autoit]$ID_BUTTON_1 = GUICtrlCreateButton ("Ownerdraw", 25, 85, 350, 90)
[/autoit] [autoit][/autoit] [autoit]
$ID_BUTTON_0 = GUICtrlCreateButton ("Standard", 25, 185, 350, 90)GUICtrlSetStyle ($ID_BUTTON_1, BitOR($WS_TABSTOP, $BS_NOTIFY, $BS_OWNERDRAW))
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetTip ($ID_BUTTON_1, "Selbstgezeichnete Schaltfläche")$hwndButton_1 = GUICtrlGetHandle ($ID_BUTTON_1)
[/autoit] [autoit][/autoit] [autoit]
$g_hTheme = OpenThemeData ($hwndButton_1, "Button");~ $g_hButtonProc = DllCallbackRegister ("ButtonWndProc", "long", "hwnd;uint;long;long")
[/autoit] [autoit][/autoit] [autoit]GUIRegisterMsg ($WM_DRAWITEM, "WM_DRAWITEM")
[/autoit] [autoit][/autoit] [autoit]
GUIRegisterMsg ($WM_MOUSEMOVE, "WM_MOUSEMOVE")GUISetState (5, $hWnd)
[/autoit] [autoit][/autoit] [autoit]While True
[/autoit] [autoit][/autoit] [autoit]Switch GUIGetMsg ( )
[/autoit] [autoit][/autoit] [autoit]
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEndEndFunc
[/autoit] [autoit][/autoit] [autoit]Func WM_DRAWITEM ($hwnd, $message, $wParam, $lParam)
[/autoit] [autoit][/autoit] [autoit]Local Const $ODA_DRAWENTIRE = 0x0001
[/autoit] [autoit][/autoit] [autoit]
Local Const $ODA_SELECT = 0x0002
Local Const $ODA_FOCUS = 0x0004
Local Const $ODS_SELECTED = 0x0001
Local Const $ODS_GRAYED = 0x0002
Local Const $ODS_DISABLED = 0x0004
Local Const $ODS_CHECKED = 0x0008
Local Const $ODS_FOCUS = 0x0010
Local Const $ODS_HOTLIGHT = 0x0040
Local Const $ODS_INACTIVE = 0x0080
Local Const $ODS_NOACCEL = 0x0100
Local Const $ODS_NOFOCUSRECT = 0x0200Local $dis = DllStructCreate ($DRAWITEMSTRUCT, $lParam)
[/autoit] [autoit][/autoit] [autoit]
Local $hDC = DllStructGetData ($dis, "hDC")
Local $hwndItem = DllStructGetData ($dis, "hwndItem")
Local $nItemAction = DllStructGetData ($dis, "itemAction")
Local $nItemState = DllStructGetData ($dis, "itemState")Local $lprcItem = DllStructGetPtr ($dis,
[/autoit] [autoit][/autoit] [autoit]Local $bChecked = BitAND($nItemState, $ODS_CHECKED)
[/autoit] [autoit][/autoit] [autoit]
Local $bFocused = BitAND($nItemState, $ODS_FOCUS)
Local $bGrayed = BitAND($nItemState, BitOR($ODS_GRAYED, $ODS_DISABLED))
Local $bSelected = BitAND($nItemState, $ODS_SELECTED)Local $sFormat = "> WM_DRAWITEM (%#x, %d, %#x, %#x)"
[/autoit] [autoit][/autoit] [autoit]ConsoleWrite (StringFormat ($sFormat, $hwnd, $message, $wParam, $lParam) & @crlf)
[/autoit] [autoit][/autoit] [autoit]
ConsoleWrite ("> CtlType = "&DllStructGetData ($dis, 1) & @crlf)
ConsoleWrite ("> CtlID = "&DllStructGetData ($dis, 2) & @crlf)
ConsoleWrite ("> itemID = "&DllStructGetData ($dis, 3) & @crlf)
ConsoleWrite ("> itemAction = "&DllStructGetData ($dis, 4) & @crlf)
ConsoleWrite ("> itemState = "&Ptr (DllStructGetData ($dis, 5)) & @crlf)
ConsoleWrite ("> hwndItem = "&DllStructGetData ($dis, 6) & @crlf)
ConsoleWrite ("> hDC = "&DllStructGetData ($dis, 7) & @crlf)
ConsoleWrite ("> rcItem.left = "&DllStructGetData ($dis, 8, 1) & @crlf)
ConsoleWrite ("> rcItem.top = "&DllStructGetData ($dis, 8, 2) & @crlf)
ConsoleWrite ("> rcItem.right = "&DllStructGetData ($dis, 8, 3) & @crlf)
ConsoleWrite ("> rcItem.bottom = "&DllStructGetData ($dis, 8, 4) & @crlf)
ConsoleWrite ("> itemData = "&DllStructGetData ($dis, 9) & @crlf)ConsoleWrite ("--------------------" & @crlf)
[/autoit] [autoit][/autoit] [autoit]If ($nItemAction == $ODA_DRAWENTIRE) Then
[/autoit] [autoit][/autoit] [autoit]If ($bFocused) Then
[/autoit] [autoit][/autoit] [autoit]
If ($bSelected) Then
DrawControlTheme ($hDC, $lprcItem, $hwndItem, $g_hTheme, $PBS_PRESSED)
Else
DrawControlTheme ($hDC, $lprcItem, $hwndItem, $g_hTheme, $PBS_DEFAULTED)
EndIf
InflateRect ($lprcItem, -3, -3)
DrawFocusRect ($hDC, $lprcItem)
Else
DrawControlTheme ($hDC, $lprcItem, $hwndItem, $g_hTheme, $PBS_NORMAL)
EndIfElseIf ($nItemAction == $ODA_FOCUS) Then
[/autoit] [autoit][/autoit] [autoit]If ($bFocused) Then
[/autoit] [autoit][/autoit] [autoit]
DrawControlTheme ($hDC, $lprcItem, $hwndItem, $g_hTheme, $PBS_DEFAULTED)
EndIf
If ($bSelected) Then
DrawControlTheme ($hDC, $lprcItem, $hwndItem, $g_hTheme, $PBS_PRESSED)
EndIf
InflateRect ($lprcItem, -3, -3)
DrawFocusRect ($hDC, $lprcItem)
EndIfReturn 1
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit]Func WM_MOUSEMOVE ($hwnd, $message, $wParam, $lParam)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit]Func AppExit ( )
[/autoit] [autoit][/autoit] [autoit]if ($g_hThemeLib) then
[/autoit] [autoit][/autoit] [autoit]
if ($g_hTheme) then
CloseThemeData ($g_hTheme)
endif
DllClose ($g_hThemeLib)
endifif ($g_hButtonProc) then
[/autoit] [autoit][/autoit] [autoit]
DllCallbackFree ($g_hButtonProc)
endifEndFunc
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
;««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««Func DrawControlTheme ($hDC, $lprect, $hwndButton, $hTheme, $iState)
[/autoit] [autoit][/autoit] [autoit]Local $rc = DllStructCreate ("long;long;long;long", $lprect)
[/autoit] [autoit][/autoit] [autoit]
Local $rcContent = DllStructCreate ("long;long;long;long")
Local $szButtonText
Local $hr
Local $cch$szButtonText = WinGetTitle ($hwndButton)
[/autoit] [autoit][/autoit] [autoit]
$cch = StringLen ($szButtonText)if ($hTheme) then
[/autoit] [autoit][/autoit] [autoit]$hr = DrawThemeBackground ($hTheme, $hDC, $BP_PUSHBUTTON, _
[/autoit] [autoit][/autoit] [autoit]
$iState, DllStructGetPtr ($rc), 0)$hr = GetThemeBackgroundContentRect ($hTheme, $hDC, _
[/autoit] [autoit][/autoit] [autoit]
$BP_PUSHBUTTON, $iState, DllStructGetPtr ($rc), DllStructGetPtr ($rcContent))$hr = DrawThemeText ($hTheme, $hDC, $BP_PUSHBUTTON, $iState, _
[/autoit] [autoit][/autoit] [autoit]
$szButtonText, $cch, _
BitOR ($DT_CENTER, $DT_VCENTER, $DT_SINGLELINE), _
0, DllStructGetPtr ($rcContent))endif
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit];««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
[/autoit] [autoit][/autoit] [autoit]Func InflateRect ($lprc, $dx, $dy)
[/autoit] [autoit][/autoit] [autoit]Local $aRes = DllCall ('user32.dll', 'int', 'InflateRect', _
[/autoit] [autoit][/autoit] [autoit]
'ptr', $lprc, _ ; rectangle
'int', $dx, _ ; amount to adjust width
'int', $dy) ; amount to adjust height
If @error Then _
Return @errorReturn $aRes[0]
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit]Func InvalidateRect ($hWnd, $lpRect, $bErase)
[/autoit] [autoit][/autoit] [autoit]Local $aRes = DllCall ('user32.dll', 'int', 'InvalidateRect', _
[/autoit] [autoit][/autoit] [autoit]
'hwnd', $hWnd, _ ; handle to window
'ptr', $lpRect, _ ; rectangle coordinates
'int', $bErase) ; erase state
If @error Then _
Return @errorReturn $aRes[0]
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit]Func DrawFocusRect ($hDC, $lprc)
[/autoit] [autoit][/autoit] [autoit]Local $aRes = DllCall ('user32.dll', 'int', 'DrawFocusRect', _
[/autoit] [autoit][/autoit] [autoit]
'ptr', $hDC, _ ; handle to device context
'ptr', $lprc) ; logical coordinates
If @error Then _
Return @errorReturn $aRes[0]
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit];««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
[/autoit] [autoit][/autoit] [autoit]Func CloseThemeData ($hTheme)
[/autoit] [autoit][/autoit] [autoit]Local $aRes = DllCall ($g_hThemeLib, 'long', 'CloseThemeData', _
[/autoit] [autoit][/autoit] [autoit]
'ptr', $hTheme)
If @error Then _
Return @errorReturn $aRes[0]
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit]Func OpenThemeData ($hwnd, $pszClassList)
[/autoit] [autoit][/autoit] [autoit]Local $aRes = DllCall ($g_hThemeLib, 'ptr', 'OpenThemeData', _
[/autoit] [autoit][/autoit] [autoit]
'hwnd', $hwnd, _
'wstr', $pszClassList)
If @error Then _
Return @errorReturn $aRes[0]
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit]Func DrawThemeBackground ($hTheme, $hdc, $iPartId, $iStateId, $pRect, $pClipRect)
[/autoit] [autoit][/autoit] [autoit]Local $aRes = DllCall ($g_hThemeLib, 'long', 'DrawThemeBackground', _
[/autoit] [autoit][/autoit] [autoit]
'ptr', $hTheme, _
'ptr', $hdc, _
'int', $iPartId, _
'int', $iStateId, _
'ptr', $pRect, _
'ptr', $pClipRect)
If @error Then _
Return @errorReturn $aRes[0]
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit]Func DrawThemeEdge ($hTheme, $hdc, $iPartId, $iStateId, $pDestRect, $uEdge, $uFlags, $pContentRect)
[/autoit] [autoit][/autoit] [autoit]Local $aRes = DllCall ($g_hThemeLib, 'long', 'DrawThemeEdge', _
[/autoit] [autoit][/autoit] [autoit]
'ptr', $hTheme, _
'ptr', $hdc, _
'int', $iPartId, _
'int', $iStateId, _
'ptr', $pDestRect, _
'uint', $uEdge, _
'uint', $uFlags, _
'ptr', $pContentRect)
If @error Then _
Return @errorReturn $aRes[0]
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit]Func DrawThemeText ($hTheme, $hdc, $iPartId, $iStateId, $pszText, $iCharCount, $dwTextFlags, $dwTextFlags2, $pRect)
[/autoit] [autoit][/autoit] [autoit]Local $aRes = DllCall ($g_hThemeLib, 'long', 'DrawThemeText', _
[/autoit] [autoit][/autoit] [autoit]
'ptr', $hTheme, _
'ptr', $hdc, _
'int', $iPartId, _
'int', $iStateId, _
'wstr', $pszText, _
'int', $iCharCount, _
'dword', $dwTextFlags, _
'dword', $dwTextFlags2, _
'ptr', $pRect)
If @error Then _
Return @errorReturn $aRes[0]
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit]Func GetThemeBackgroundContentRect ($hTheme, $hdc, $iPartId, $iStateId, $pBoundingRect, $pContentRect)
[/autoit] [autoit][/autoit] [autoit]Local $aRes = DllCall ($g_hThemeLib, 'long', 'GetThemeBackgroundContentRect', _
[/autoit] [autoit][/autoit] [autoit]
'ptr', $hTheme, _
'ptr', $hdc, _
'int', $iPartId, _
'int', $iStateId, _
'ptr', $pBoundingRect, _
'ptr', $pContentRect)
If @error Then _
Return @errorReturn $aRes[0]
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit];««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit]Gruß
Greenhorn -
Ja...
Juhuuuu...
Danke...
Das war das Script, da wär ich nie drauf gekommen.
Und geil dass es nur 2-5min gedauert hat bis ne Antwort kam