Что нового

Не меняется цвет у GUICtrlSetGraphic

GUIMish

Знающий
Сообщения
122
Репутация
12
Здравствуйте, я вот тут печатаю небольшую программку, что-бы она расставляла <p>*</p>.
Но вот какая проблема, у меня почему-то не получается перекрасить GUICtrlSetGraphic, вот я там поставил комментарии, в тех местах. Помогите разобраться пожалуйста.

Код:
#include <GUIConstantsEx.au3>
#include <GUIEdit.au3>

$Window = GUICreate("Generator <p>", 400, 480, -1, -1, 204799 + 0x00040000)
GUISetBkColor(0xffffff)
GUISetFont(10, -1, -1, "Lucida Console")

$Text = GUICtrlCreateEdit("", 0, 0, 398, 436, 2101248)
	GUICtrlSetResizing(-1, 102)

$b = GUICtrlCreateButton("", 25, 436, 373, 20)
	GUICtrlSetResizing(-1, 2 + 4 + 512)

$Lmp = GUICtrlCreateGraphic(0, 0)
	GUICtrlSetResizing(-1, 2 + 64 + 512)
	GUICtrlSetGraphic(-1, 8, 0x000000, -2)
	GUICtrlSetGraphic(-1, 12, 5, 439, 15, 15)

GUISetState()
_WinAPI_LoadKeyboardLayoutEx(0x0409)
$nDummy = GUICtrlCreateDummy()
Dim $aAccelKeys[1][2] = [["^a", $nDummy]]
GUISetAccelerators($aAccelKeys)
GUIRegisterMsg(0x0024, "WM_GETMINMAXINFO")
$Pr = True
While 1
	Switch GUIGetMsg()
		Case -3
			Exit
		Case $nDummy
            _GUICtrlEdit_SetSel($Text, 0, -1)
		Case $b
			GUICtrlSetGraphic($Lmp, $GUI_GR_COLOR, 0x000000, 0xff0000) ; Не перекрашивает в крысный цвет

            $aArray = StringSplit(GUICtrlRead($Text), @CRLF, 1)
			GUICtrlSetData($Text, "")
			For $i = 1 to $aArray[0]
				If GUICtrlRead($Text) = "" Then
					GUICtrlSetData($Text, "<p>" & $aArray[$i] & "</p>")
				Else
					GUICtrlSetData($Text, GUICtrlRead($Text) & @CRLF & "<p>" & $aArray[$i] & "</p>")
				EndIf
			Next

			GUICtrlSetGraphic($Lmp, $GUI_GR_COLOR, 0x000000, 0x00ff00) ; Не перекрашивает в зеленый
   EndSwitch
WEnd

Func _WinAPI_LoadKeyboardLayoutEx($sLayoutID = 0x0409, $hWnd = 0)
    Local Const $WM_INPUTLANGCHANGEREQUEST = 0x50
    Local $aRet = DllCall("user32.dll", "long", "LoadKeyboardLayoutW", "wstr", Hex($sLayoutID, 8), "int", 0)

    If Not @error And $aRet[0] Then
        If $hWnd = 0 Then
            $hWnd = WinGetHandle(AutoItWinGetTitle())
        EndIf

        DllCall("user32.dll", "ptr", "SendMessage", "hwnd", $hWnd, "int", $WM_INPUTLANGCHANGEREQUEST, "int", 1, "int", $aRet[0])
        Return 1
	 EndIf
    Return SetError(1)
 EndFunc

Func WM_GETMINMAXINFO($hWnd, $iMsg, $wParam, $lParam)
   Local $tMINMAXINFO = DllStructCreate("int;int;" & "int MaxSizeX; int MaxSizeY;" & "int MaxPositionX;int MaxPositionY;" & "int MinTrackSizeX; int MinTrackSizeY;" & "int MaxTrackSizeX; int MaxTrackSizeY", $lParam)
   DllStructSetData($tMINMAXINFO, "MinTrackSizeX", 250)
   DllStructSetData($tMINMAXINFO, "MinTrackSizeY", 300)
   Return 'GUI_RUNDEFMSG'
EndFunc
 

AZJIO

Меценат
Меценат
Сообщения
2,879
Репутация
1,194
GUIMish
А если $GUI_GR_REFRESH = Обновить элемент Graphic.
 

CreatoR

Must AutoIt!
Команда форума
Администратор
Сообщения
8,671
Репутация
2,481
Код:
...

$Lmp = GUICtrlCreateGraphic(5, 439, 15, 15)
GUICtrlSetResizing(-1, 2 + 64 + 512)
GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, 15, 15, 360)

...

While 1
    ...
        Case $b
			GUICtrlSetGraphic($Lmp, $GUI_GR_COLOR, 0x000000, 0xff0000)
			GUICtrlSetGraphic($Lmp, $GUI_GR_ELLIPSE, 0, 0, 15, 15, 360)
			GUICtrlSetGraphic($Lmp, $GUI_GR_REFRESH)
			
            ...
			
			GUICtrlSetGraphic($Lmp, $GUI_GR_COLOR, 0x000000, 0x00ff00)
			GUICtrlSetGraphic($Lmp, $GUI_GR_ELLIPSE, 0, 0, 15, 15, 360)
			GUICtrlSetGraphic($Lmp, $GUI_GR_REFRESH)
   EndSwitch
WEnd

...
 
Верх