找回密码
 加入
搜索
查看: 2420|回复: 3

[AU3基础] _WinAPI_SetWindowTheme

[复制链接]
发表于 2011-10-14 22:01:56 | 显示全部楼层 |阅读模式
不罗嗦了,直接看代码吧
#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

If _WinAPI_GetVersion() < '6.0' Then
        MsgBox(16, 'Error', 'Require Windows Vista or later.')
        Exit
EndIf

Global $ListView,$ListView2
GUICreate('old style', 332, 400)
$ListView = GUICtrlCreateListView('Column 1|Column 2|Column 3|Column 4', 10, 10, 312, 380)
For $i = 1 To 9
        GUICtrlCreateListViewItem('Item ' & $i & '|' & 'Sub ' & $i & '|' & 'Sub ' & $i & '|' & 'Sub ' & $i, $ListView)
Next
GUISetState()
Do
Until GUIGetMsg() = -3

GUICreate('vista style',332,400)
$ListView2=GUICtrlCreateListView('Column 1|Column 2|Column 3|Column 4', 10, 10, 312, 380)
For $i = 1 To 9
        GUICtrlCreateListViewItem('Item ' & $i & '|' & 'Sub ' & $i & '|' & 'Sub ' & $i & '|' & 'Sub ' & $i, $ListView2)
Next
_WinAPI_SetWindowTheme(GUICtrlGetHandle($ListView2), 'Explorer')
GUISetState()
Do
Until GUIGetMsg() = -3

Exit

win7/vista有效,xp下应该没变化。。。
发表于 2011-10-15 00:48:10 | 显示全部楼层
什么意思,帮助里的例子直接贴上来?
发表于 2011-10-15 01:11:27 | 显示全部楼层
比  较 蛋 疼
发表于 2011-10-15 16:10:39 | 显示全部楼层
回复 1# 蜘蛛抱蛋


不罗嗦了,直接看代码吧



#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#Include <WinAPIEx.au3>

If Not FileExists(@ScriptDir & "\xjl.jpg") Then
        InetGet("http://img.sdchina.com/news/20100106/c01_32aa3f4c-461c-4ec5-b6c3-f41454931de4_8.jpg", @ScriptDir & "\xjl.jpg")
EndIf

GUICreate("Test Theme", 300, 200)
$pic = GUICtrlCreatePic(@ScriptDir & "\xjl.jpg", 0, 0, 300, 200)
GUICtrlSetState(-1, $GUI_DISABLE)
$group = GUICtrlCreateGroup("Group", 10, 10, 280, 100)
_WinAPI_SetWindowTheme(GUICtrlGetHandle($group), 0, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUIRegisterMsg($WM_CTLCOLORSTATIC, "WM_CTLCOLORSTATIC")

GUISetState()

While True
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

Func WM_CTLCOLORSTATIC($hWnd, $Msg, $wParam, $lParam)
        DllCall("gdi32.dll", "int", "SetBkMode", "hwnd", $wParam, "int", $TRANSPARENT)
    DllCall("gdi32.dll", "int", "SetTextColor", "hwnd", $wParam, "int", 0xFF0000)
    If $lParam = GUICtrlGetHandle($group) Then Return _WinAPI_GetStockObject($NULL_BRUSH)
EndFunc
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-23 03:28 , Processed in 0.080678 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表