_SetTrayBkColor
Устанавливает цвет фона под текстом в меню иконки трея.
#Include <ModernMenuRaw.au3>
_SetTrayBkColor ( $nColor )
Параметры
$nColor | Цвет в формате BGR |
Примечания
В качестве альтернативы достаточно присвоить цвет переменной $nTrayBkClr, которая является внутренней глобальной переменной. Переменная $bUseAdvTrayMenu не должна быть False (по умолчанию True).Пример
; Holger
; http://www.autoitscript.com/forum/topic/20967-guitray-menu-with-icons-and-colors/
#include "ModernMenuRaw.au3"
#include <GUIConstantsEx.au3>
#NoTrayIcon
Opt("GUIOnEventMode", 1)
Opt("TrayMenuMode", 7)
_SetFlashTimeOut(250)
$nTrayIcon = _TrayIconCreate("Моя программа", "shell32.dll", -209)
_TrayCreateContextMenu()
$action = _TrayCreateMenu('Выбор темы')
_TrayItemSetIcon(-1, "mspaint.exe", 0)
$SetRed = _TrayCreateItem('Красная', $action, -1, 1)
GUICtrlSetOnEvent(-1, "SetRedTrayColors")
_TrayItemSetIcon(-1, "", 0)
$SetGreen = _TrayCreateItem('Зелёная', $action, -1, 1)
GUICtrlSetOnEvent(-1, "SetGreenTrayColors")
_TrayItemSetIcon(-1, "", 0)
$SetBlue = _TrayCreateItem('Синяя', $action, -1, 1)
GUICtrlSetOnEvent(-1, "SetBlueTrayColors")
_TrayItemSetIcon(-1, "", 0)
$SetOLBlue = _TrayCreateItem('Outlook синяя', $action, -1, 1)
GUICtrlSetOnEvent(-1, "SetOLBlueColors")
_TrayItemSetIcon(-1, "", 0)
$SetOLSilver = _TrayCreateItem('Outlook серебряная', $action, -1, 1)
GUICtrlSetOnEvent(-1, "SetOLSilverColors")
_TrayItemSetIcon(-1, "", 0)
$nAbout = _TrayCreateItem('О программе')
_TrayItemSetIcon(-1, "shell32.dll", -222)
$nExit = _TrayCreateItem('Выход')
GUICtrlSetOnEvent(-1, "_Quit")
_TrayItemSetIcon(-1, "shell32.dll", -216)
SetOLSilverColors()
_TrayIconSetState()
While 1
Sleep(10000)
WEnd
Func _Quit()
_TrayIconDelete($nTrayIcon)
Exit
EndFunc
Func SetCheckedItem($DefaultItem)
GUICtrlSetState($SetRed, $GUI_UNCHECKED)
GUICtrlSetState($SetGreen, $GUI_UNCHECKED)
GUICtrlSetState($SetBlue, $GUI_UNCHECKED)
GUICtrlSetState($SetOLBlue, $GUI_UNCHECKED)
GUICtrlSetState($SetOLSilver, $GUI_UNCHECKED)
GUICtrlSetState($DefaultItem, $GUI_CHECKED)
EndFunc
Func SetRedTrayColors()
SetCheckedItem($SetRed)
_SetTrayTextColor(0x000000)
_SetTrayBkColor(0xAADDFF)
_SetTrayIconBkColor(0x5566BB)
_SetTrayIconBkGrdColor(0x5566BB)
_SetTraySelectBkColor(0x70A0C0)
_SetTraySelectRectColor(0x854240)
_SetTraySelectTextColor(0x000000)
EndFunc
Func SetGreenTrayColors()
SetCheckedItem($SetGreen)
_SetTrayTextColor(0x000000)
_SetTrayBkColor(0xAAFFAA)
_SetTrayIconBkColor(0x66BB66)
_SetTrayIconBkGrdColor(0x66BB66)
_SetTraySelectBkColor(0xBBCC88)
_SetTraySelectRectColor(0x222277)
_SetTraySelectTextColor(0x770000)
EndFunc
Func SetBlueTrayColors()
SetCheckedItem($SetBlue)
_SetTrayTextColor(0x000000)
_SetTrayBkColor(0xFFD8C0)
_SetTrayIconBkColor(0xEE8877)
_SetTrayIconBkGrdColor(0x703330)
_SetTraySelectBkColor(0x662222)
_SetTraySelectRectColor(0x4477AA)
_SetTraySelectTextColor(0x66FFFF)
EndFunc
Func SetOLBlueColors()
SetCheckedItem($SetOLBlue)
_SetTrayTextColor(0x000000)
_SetTrayBkColor(0xFFFFFF)
_SetTrayIconBkColor(0xFFEFE3)
_SetTrayIconBkGrdColor(0xE4AD87)
_SetTraySelectBkColor(0xC2EEFF)
_SetTraySelectRectColor(0x800000)
_SetTraySelectTextColor(0x000000)
EndFunc
Func SetOLSilverColors()
SetCheckedItem($SetOLSilver)
_SetTrayTextColor(0x000000)
_SetTrayBkColor(0xF9F9F9)
_SetTrayIconBkColor(0xFDFDFD)
_SetTrayIconBkGrdColor(0xC0A0A0)
_SetTraySelectBkColor(0xC2EEFF)
_SetTraySelectRectColor(0x800000)
_SetTraySelectTextColor(0x000000)
EndFunc