我的语言表达能力有限,还是上代码解释吧.
根据_WinAPI_SetLayeredWindowAttributes函数原型可知使用的是ABGR颜色
#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)
Global $listview, $hWndListView, $GUI, $hgui, $iIndex = -1
;========================================================== ; 【测试值在此】
Global $BKColor = 0xFF0000
;~ Global $BKColor = 0xABABAB ; 纯 灰度 色值 , R = G = B
;==========================================================
;~ _SetLayered(0xABCDEF)
_Main()
Func _Main()
$hgui = GUICreate("ListView Hit Test", 600, 400)
GUISetBkColor(0x00ffFF)
$GUI = GUICreate("ListView Hit Test", 400, 300,-1,-1,$WS_POPUP,BitOR($WS_EX_LAYERED,$WS_EX_MDICHILD),$hgui)
GUISetBkColor($BKColor)
$ListView = GUICtrlCreateListView("", 2, 10, 394, 248)
GUIctrlSetBkColor(-1,$BKColor)
$hWndListView = GUICtrlGetHandle($ListView)
_GUICtrlListView_SetExtendedListViewStyle($hWndListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
; Add columns
_GUICtrlListView_AddColumn($ListView, "Column 1", 100)
_GUICtrlListView_AddColumn($ListView, "Column 2", 100)
_GUICtrlListView_AddColumn($ListView, "Column 3", 100)
GUICtrlCreateListViewItem("1|ITEM|C:\",$listview)
GUICtrlCreateListViewItem("1|ITEM|C:\",$listview)
GUICtrlCreateListViewItem("1|ITEM|C:\",$listview)
GUICtrlCreateListViewItem("1|ITEM|C:\",$listview)
GUICtrlCreateListViewItem("1|ITEM|C:\",$listview)
GUICtrlCreateListViewItem("1|ITEM|C:\",$listview)
GUICtrlCreateListViewItem("1|ITEM|C:\",$listview)
GUICtrlCreateListViewItem("1|ITEM|C:\",$listview)
GUICtrlCreateListViewItem("1|ITEM|C:\",$listview)
GUICtrlCreateListViewItem("1|ITEM|C:\",$listview)
_WinAPI_SetLayeredWindowAttributes($GUI, _SetLayered($BKColor), 255,0x03,True)
GUISetState(@SW_SHOW,$gui)
GUISetState(@SW_SHOW,$hgui)
;~ GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
; Loop until user exits
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
EndFunc ;==>_Main
Func _SetLayered($Rgb2Bgr)
$Rgb2Bgr = Hex(String($Rgb2Bgr), 6)
$Rgb2Bgr = Execute('0x32' & StringMid($Rgb2Bgr, 5, 2) & StringMid($Rgb2Bgr, 3, 2) & StringMid($Rgb2Bgr, 1, 2))
Return $Rgb2Bgr
EndFunc
|