简体   繁体   中英

Change Tab Control background color in AutoIt

I am working on an application which deals with lots of tab controls. Each Tab item has a different color. I looked on Google and got a solution but it was not enough. Every one was change the tab item color not the tab control itself.

OK it was too easy. Now I want to change the tab Control color where it is highlighted in red, see below:

在此输入图像描述

Maybe you can try this: (free after this other example )

#include <GUIConstantsEx.au3>
#include <ColorConstants.au3>
#include <GuiTab.au3>

Example()

Func Example()
   local $Form=GUICreate("My GUI Tab") ; will create a dialog box that when displayed is centered

   GUISetBkColor(0x00E0FFFF)
   GUISetFont(9, 300)

   local $Tab = GUICtrlCreateTab(10, 10, 200, 100)
   _GUICtrlTabHeader_SetBkColor($Form, $Tab, 0xFF0000) ;set tab header color

   GUICtrlCreateTabItem("tab0")
   GUICtrlCreateTabItem("tab1")
   GUICtrlCreateTabItem("") ; end tabitem definition

   GUISetState(@SW_SHOW)
   For $iIndex = _GUICtrlTab_GetItemCount($Tab) To 0 step -1 ;show tabs
      _GUICtrlTab_ActivateTab ( $Tab, $iIndex )
   Next
   Local $idMsg
   While 1 ; Loop until the user exits.
       $idMsg = GUIGetMsg()
       If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop
   WEnd
EndFunc   ;==>Example

Func _GUICtrlTabHeader_SetBkColor($hWnd, $hSysTab32, $sBkColor)
   Local $aTabPos = ControlGetPos($hWnd, "", $hSysTab32)
   Local $aTab_Rect = _GUICtrlTab_GetItemRect($hSysTab32, -1)
   GUICtrlCreateLabel("", $aTabPos[0]+2, $aTabPos[1], $aTabPos[2]-6, $aTab_Rect[3]+3)
   GUICtrlSetBkColor(-1,  $sBkColor)
   GUICtrlSetState(-1, $GUI_DISABLE)
EndFunc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM