Показать полную графическую версию : [решено] Поменять цвет текста GUICtrlCreateCheckbox
Centrinar
10-02-2011, 19:10
Есть функция создания GUICtrlCreateCheckbox
Func _GUICtrlCreateCheckboxEx($sText, $iLeft, $iTop, $iWidth, $iHeight, $sIconFile="", $nIconIndex=0)
Local $aRetArr[2]
$aRetArr[0] = GUICtrlCreateIcon($sIconFile, $nIconIndex, $iLeft - 20, $iTop - 1, 16, 16)
GUICtrlSetState($aRetArr[0], $GUI_DISABLE)
$aRetArr[1] = GUICtrlCreateCheckbox($sText, $iLeft, $iTop, $iWidth, $iHeight)
GUICtrlSetBkColor($aRetArr[1], 0xFFFFFF)
Return $aRetArr
EndFunc
Как в ней изменить цвет самого текста
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <GUIConstantsEx.au3>
$hGUI = GUICreate (http://www.autoitscript.com/autoit3/docs/functions/GUICreate.htm)("_GUICtrlCreateCheckboxEx", 300, 200)
$aChckBx = _GUICtrlCreateCheckboxEx("Checkbox", 20, 20, 65, 15, 0xFFFFFF, 0xFF0000)
GUISetState (http://www.autoitscript.com/autoit3/docs/functions/GUISetState.htm)(@SW_SHOW (http://www.autoitscript.com/autoit3/docs/macros.htm#@sw_show), $hGUI)
While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) 1
$nMsg = GUIGetMsg (http://www.autoitscript.com/autoit3/docs/functions/GUIGetMsg.htm)()
Switch (http://www.autoitscript.com/autoit3/docs/keywords.htm#Switch) $nMsg
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $GUI_EVENT_CLOSE
Exit (http://www.autoitscript.com/autoit3/docs/keywords.htm#Exit)
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $aChckBx[1]
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) GUICtrlRead (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlRead.htm)($nMsg - 1) = $GUI_CHECKED Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
GUICtrlSetState (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetState.htm)($nMsg - 1, $GUI_UNCHECKED)
Else (http://www.autoitscript.com/autoit3/docs/keywords.htm#Else)
GUICtrlSetState (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetState.htm)($nMsg - 1, $GUI_CHECKED)
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
EndSwitch (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndSwitch)
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)
Func (http://www.autoitscript.com/autoit3/docs/keywords.htm#Func) _GUICtrlCreateCheckboxEx($sText, $iLeft, $iTop, $iWidth, $iHeight, $sBackColor = "" , $sTextColor = "")
Local (http://www.autoitscript.com/autoit3/docs/keywords.htm#Local) $aCheckBoxID[2]
$aCheckBoxID[0] = GUICtrlCreateCheckbox (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateCheckbox.htm)("", $iLeft, $iTop, 16, 16)
$aCheckBoxID[1] = GUICtrlCreateLabel (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateLabel.htm)($sText, $iLeft + 15, $iTop, $iWidth - 15, $iHeight)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $sTextColor <> "" And (http://www.autoitscript.com/autoit3/docs/keywords.htm#And) $aCheckBoxID[1] Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
GUICtrlSetColor (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetColor.htm)($aCheckBoxID[1], $sTextColor)
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $sBackColor <> "" And (http://www.autoitscript.com/autoit3/docs/keywords.htm#And) $aCheckBoxID[1] Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
GUICtrlSetBkColor (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetBkColor.htm)($aCheckBoxID[1], $sBackColor)
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
Return (http://www.autoitscript.com/autoit3/docs/keywords.htm#Return) $aCheckBoxID
EndFunc (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndFunc)
Centrinar
10-02-2011, 22:58
Creat0R спасибо за помощь, но как всегда до меня с 5 раза доходит. Вот образец скрипта, ты мне с ним и помогал когда то)))) Покажи на нем пож. а то на первом примере не выходит
madmasles
11-02-2011, 01:09
Ссылку бы на GUIScrollbars_Ex.au3 еще поиметь...
Ссылку бы на GUIScrollbars_Ex.au3 еще поиметь... »
Прикрепил все нужные файлы.
© OSzone.net 2001-2012
vBulletin v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.
Available in ZeroNet 1osznRoVratMCN3bFoFpR2pSV5c9z6sTC