#include <Color.au3>
#include <WinAPIGdi.au3>
Opt("PixelCoordMode", 2)
$Color = 0xFF0000 ; красный
$Hilight = _ColorSetRGB(StringSplit(RegRead("HKCU\Control Panel\Colors", "Hilight"), " ", 2))
If @error Then $iHilight = 0x3399FF
$GUI = GUICreate("")
$Inp = GUICtrlGetHandle(GUICtrlCreateInput("", 10, 10, 300))
$Pos = ControlGetPos($GUI, "", $Inp)
GUISetState()
Do
If ControlCommand($GUI, "", $Inp, "GetSelected") And IsArray(PixelSearch(0, 0, $Pos[2], $Pos[3], $Hilight, 0, 1, $Inp)) Then
$DC = _WinAPI_GetDC($Inp)
For $i = 0 To $Pos[2]
For $j = 0 To $Pos[3]
If _WinAPI_GetPixel($DC, $i, $j) = $Hilight Then _WinAPI_SetPixel($DC, $i, $j, $Color)
Next
Next
_WinAPI_ReleaseDC($Inp, $DC)
EndIf
Until GUIGetMsg() = -3
@saraconor Можно перекрашивать пиксели "на лету". Только из-за медлительности AutoIt получится "анимашка"Код:#include <Color.au3> #include <WinAPIGdi.au3> Opt("PixelCoordMode", 2) $Color = 0xFF0000 ; красный $Hilight = _ColorSetRGB(StringSplit(RegRead("HKCU\Control Panel\Colors", "Hilight"), " ", 2)) If @error Then $iHilight = 0x3399FF $GUI = GUICreate("") $Inp = GUICtrlGetHandle(GUICtrlCreateInput("", 10, 10, 300)) $Pos = ControlGetPos($GUI, "", $Inp) GUISetState() Do If ControlCommand($GUI, "", $Inp, "GetSelected") And IsArray(PixelSearch(0, 0, $Pos[2], $Pos[3], $Hilight, 0, 1, $Inp)) Then $DC = _WinAPI_GetDC($Inp) For $i = 0 To $Pos[2] For $j = 0 To $Pos[3] If _WinAPI_GetPixel($DC, $i, $j) = $Hilight Then _WinAPI_SetPixel($DC, $i, $j, $Color) Next Next _WinAPI_ReleaseDC($Inp, $DC) EndIf Until GUIGetMsg() = -3
Можно. Только действовать будет сразу на все окнаоперативно менять вот эти цвета
#include <WinAPISysWin.au3>
#include <WindowsConstants.au3>
; цвет в формате BGR
_WinAPI_SetSysColors($COLOR_HIGHLIGHT, 0x0000FF) ; красный
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPISysWin.au3>
$iOld_Color = _WinAPI_GetSysColor($COLOR_HIGHLIGHT)
$iInput_Color = 0xFF0000 ;красный
$hGUI = GUICreate('')
$iInput = GUICtrlCreateInput('Test', 20, 20)
GUISetState()
_WinAPI_SetSysColors($COLOR_HIGHLIGHT, _ColorRevers($iInput_Color))
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
_WinAPI_SetSysColors($COLOR_HIGHLIGHT, $iOld_Color)
Exit
EndSwitch
WEnd
Func _ColorRevers($iColor)
Local $iMask = BitXOR(BitAND($iColor, 0xFF), ($iColor / 0x10000))
Return '0x' & Hex(BitXOR($iColor, ($iMask * 0x10001)), 6)
EndFunc
#include <GUIConstantsEx.au3>
#include <GuiRichEdit.au3>
#include <WindowsConstants.au3>
Global $hGui, $hRichEdit, $iColor = 0x0000FF00
$hGui = GUICreate(StringTrimRight(@ScriptName, StringLen('.exe')), 200, 50, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, 'Это какой-то текст.', 10, 10, 180, 22, $ES_AUTOHSCROLL)
_SendMessage($hRichEdit, $EM_SETEVENTMASK, 0, $ENM_SELCHANGE)
GUISetState(@SW_SHOW)
GUIRegisterMsg($WM_NOTIFY, '_WM_NOTIFY')
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
_GUICtrlRichEdit_Destroy($hRichEdit)
ExitLoop
EndSwitch
WEnd
Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
Local $hWndFrom, $iCode, $tNMHDR
$tNMHDR = DllStructCreate($tagNMHDR, $lParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, 'hWndFrom'))
$iCode = DllStructGetData($tNMHDR, 'Code')
Switch $hWndFrom
Case $hRichEdit
If $iCode = $EN_SELCHANGE Then
_GUICtrlRichEdit_SetCharDefaultColor($hRichEdit)
_GUICtrlRichEdit_SetCharBkColor($hRichEdit, $iColor)
Return
EndIf
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>_WM_NOTIFY
Func _GUICtrlRichEdit_SetCharDefaultColor($hWnd)
Local $tCharFormat = DllStructCreate($tagCHARFORMAT2)
DllStructSetData($tCharFormat, 'cbSize', DllStructGetSize($tCharFormat))
DllStructSetData($tCharFormat, 'dwMask', $CFM_BACKCOLOR)
DllStructSetData($tCharFormat, 'crBackColor', _GUICtrlRichEdit_GetBkColor($hWnd))
Return _SendMessage($hWnd, $EM_SETCHARFORMAT, $SCF_ALL, $tCharFormat, 0, "wparam", "struct*") <> 0
EndFunc ;==>_GUICtrlRichEdit_SetCharColor