Sign in to follow this  
Followers 0
jiglei

Is it possible to change the backround color of a tab control?

5 posts in this topic

#1 ·  Posted (edited)

Hello everyone, I was wondering if it was possible to change the backround color of a tab control, cause it looks awful in my current gui, with those standard colors.

I'm managing to do a program in blue scales, or maybe i'll change to black scales, but thats not what matters anyway, i'd like that the tabs also could be colored.

I'm using Koda to build my guis, maybe thats what stopping me from coloring them, but not even in help file i can find somehow to do it.

If someone can answer me i'd be grateful.

Thanks for reading.

Edit:By the way some strange thing happened to my gui:

Posted Image

Koda didn't show gui like that...

here is the full generated code by Koda, i don't understand why it stands white like that...

#Region ### START Koda GUI section ### Form=c:\users\david\desktop\autoit\sbot manager.kxf
$Form2 = GUICreate("Form1", 449, 303, 365, 173)
GUISetBkColor(0x3399FF)
$Tab1 = GUICtrlCreateTab(0, 0, 448, 297)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("Window 1")
$Group1 = GUICtrlCreateGroup("Char Data", 8, 32, 433, 105)
$Label1 = GUICtrlCreateLabel("Char Name:", 16, 48, 60, 17)
$Label2 = GUICtrlCreateLabel("Name", 80, 48, 32, 17)
$Label3 = GUICtrlCreateLabel("Level:", 16, 64, 33, 17)
$Label4 = GUICtrlCreateLabel("lvl", 48, 64, 14, 17)
$Label5 = GUICtrlCreateLabel("Gold:", 16, 80, 29, 17)
$Label6 = GUICtrlCreateLabel("0", 48, 80, 10, 17)
$Label7 = GUICtrlCreateLabel("SP:", 16, 96, 21, 17)
$Label8 = GUICtrlCreateLabel("0", 40, 96, 10, 17)
$Progress1 = GUICtrlCreateProgress(192, 48, 150, 24)
GUICtrlSetColor($Progress1, 0x00FF00)
$Label9 = GUICtrlCreateLabel("Exp:", 160, 56, 25, 17)
$Label10 = GUICtrlCreateLabel("0%", 248, 52, 18, 17)
$Label11 = GUICtrlCreateLabel("HP:", 160, 80, 22, 17)
$Label12 = GUICtrlCreateLabel("MP:", 160, 104, 23, 17)
$Progress2 = GUICtrlCreateProgress(192, 80, 150, 16)
GUICtrlSetColor($Progress2, 0xFF0000)
$Progress3 = GUICtrlCreateProgress(192, 104, 150, 16)
GUICtrlSetColor($Progress3, 0x0000FF)
$Label13 = GUICtrlCreateLabel("0%", 248, 82, 18, 17)
$Label14 = GUICtrlCreateLabel("0%", 248, 106, 18, 17)
$Label17 = GUICtrlCreateLabel("Bot Status:", 16, 112, 56, 17)
$Label18 = GUICtrlCreateLabel("none", 72, 112, 28, 17)
$Button9 = GUICtrlCreateButton("test", 360, 72, 75, 25, $WS_GROUP)
$Group2 = GUICtrlCreateGroup("Managing", 8, 136, 433, 97)
$Button1 = GUICtrlCreateButton("Hide Window", 16, 160, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Button2 = GUICtrlCreateButton("Show Window", 16, 184, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Button3 = GUICtrlCreateButton("Start Training", 104, 160, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Button4 = GUICtrlCreateButton("StopTraining", 104, 184, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Button5 = GUICtrlCreateButton("Show/Hide Client", 192, 160, 91, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Button6 = GUICtrlCreateButton("Save settings", 296, 160, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Button7 = GUICtrlCreateButton("Change Script", 192, 184, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Group3 = GUICtrlCreateGroup("Set Radius", 288, 184, 121, 41)
GUICtrlCreateInput("", 318, 198, 57, 21)
$Button8 = GUICtrlCreateButton("Close Window", 16, 208, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Group4 = GUICtrlCreateGroup("Notifications", 8, 232, 433, 57)
$Checkbox1 = GUICtrlCreateCheckbox("Play a sound when this character DC", 16, 248, 201, 17)
$Label15 = GUICtrlCreateLabel("Last recieved PM time:", 16, 264, 112, 17)
$Label16 = GUICtrlCreateLabel("[HH:MM:SS]", 128, 264, 64, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Don't ask me anything related with the program >_<, if you can't understand what it is aplied, its because its not build for you to use xD

Thanks...

Edited by jiglei

Share this post


Link to post
Share on other sites



It would be better to post some code we can run.

I cannot see the effect you show but it looks like you are using WIn98 or you have themes turned off in XP maybe.

If its just the group labels that are the problem then change the caption to '' and place a label with the correct colour there.

There are examples of coloured tabs, search for $TCS_OWNERDRAWFIXED. Rasim did a nice one I think.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

I'm running windows vista with classic theme on, to save RAM.

I re-started explorer.exe to see if that was the problem, keeps on showing that.

Might be some bug... i dunno...

But when running in vista mode, the whole window appears white, so i might give up the colored thing, cause its cooler on vista.

Thank you anyway >_<

Share this post


Link to post
Share on other sites

jiglei,

The simple function I have added to your code colours the tabs - or, to be more precise, adds a coloured label to the tab. Does this help?:

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <GuiTab.au3>

#Region ### START Koda GUI section ### Form=c:\users\david\desktop\autoit\sbot manager.kxf
$Form2 = GUICreate("Form1", 449, 303, 365, 173)
GUISetBkColor(0xC4C4C4)
$Tab1 = GUICtrlCreateTab(0, 0, 448, 297)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("Window 1")
_GUICtrlTab_SetBkColor($Form2, $Tab1, 0xFF0000)
$Group1 = GUICtrlCreateGroup("Char Data", 8, 32, 433, 105)
$Label1 = GUICtrlCreateLabel("Char Name:", 16, 48, 60, 17)
$Label2 = GUICtrlCreateLabel("Name", 80, 48, 32, 17)
$Label3 = GUICtrlCreateLabel("Level:", 16, 64, 33, 17)
$Label4 = GUICtrlCreateLabel("lvl", 48, 64, 14, 17)
$Label5 = GUICtrlCreateLabel("Gold:", 16, 80, 29, 17)
$Label6 = GUICtrlCreateLabel("0", 48, 80, 10, 17)
$Label7 = GUICtrlCreateLabel("SP:", 16, 96, 21, 17)
$Label8 = GUICtrlCreateLabel("0", 40, 96, 10, 17)
$Progress1 = GUICtrlCreateProgress(192, 48, 150, 24)
GUICtrlSetColor($Progress1, 0x00FF00)
$Label9 = GUICtrlCreateLabel("Exp:", 160, 56, 25, 17)
$Label10 = GUICtrlCreateLabel("0%", 248, 52, 18, 17)
$Label11 = GUICtrlCreateLabel("HP:", 160, 80, 22, 17)
$Label12 = GUICtrlCreateLabel("MP:", 160, 104, 23, 17)
$Progress2 = GUICtrlCreateProgress(192, 80, 150, 16)
GUICtrlSetColor($Progress2, 0xFF0000)
$Progress3 = GUICtrlCreateProgress(192, 104, 150, 16)
GUICtrlSetColor($Progress3, 0x0000FF)
$Label13 = GUICtrlCreateLabel("0%", 248, 82, 18, 17)
$Label14 = GUICtrlCreateLabel("0%", 248, 106, 18, 17)
$Label17 = GUICtrlCreateLabel("Bot Status:", 16, 112, 56, 17)
$Label18 = GUICtrlCreateLabel("none", 72, 112, 28, 17)
$Button9 = GUICtrlCreateButton("test", 360, 72, 75, 25, $WS_GROUP)
$Group2 = GUICtrlCreateGroup("Managing", 8, 136, 433, 97)
$Button1 = GUICtrlCreateButton("Hide Window", 16, 160, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Button2 = GUICtrlCreateButton("Show Window", 16, 184, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Button3 = GUICtrlCreateButton("Start Training", 104, 160, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Button4 = GUICtrlCreateButton("StopTraining", 104, 184, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Button5 = GUICtrlCreateButton("Show/Hide Client", 192, 160, 91, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Button6 = GUICtrlCreateButton("Save settings", 296, 160, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Button7 = GUICtrlCreateButton("Change Script", 192, 184, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Group3 = GUICtrlCreateGroup("Set Radius", 288, 184, 121, 41)
GUICtrlCreateInput("", 318, 198, 57, 21)
$Button8 = GUICtrlCreateButton("Close Window", 16, 208, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Group4 = GUICtrlCreateGroup("Notifications", 8, 232, 433, 57)
$Checkbox1 = GUICtrlCreateCheckbox("Play a sound when this character DC", 16, 248, 201, 17)
$Label15 = GUICtrlCreateLabel("Last recieved PM time:", 16, 264, 112, 17)
$Label16 = GUICtrlCreateLabel("[HH:MM:SS]", 128, 264, 64, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1

    If GUIGetMsg() = -3 Then Exit

WEnd

Func _GUICtrlTab_SetBkColor($hWnd, $hSysTab32, $sBkColor)
    Local $aTabPos = ControlGetPos($hWnd, "", $hSysTab32)

    Local $aTab_Rect = _GUICtrlTab_GetItemRect($hSysTab32, -1)

    GUICtrlCreateLabel("", $aTabPos[0]+2, $aTabPos[1]+$aTab_Rect[3]+4, $aTabPos[2]-6, $aTabPos[3]-$aTab_Rect[3]-7)
    GUICtrlSetBkColor(-1, $sBkColor)
    GUICtrlSetState(-1, $GUI_DISABLE)
EndFunc

I think you will have to change the Windows Appearance to solve the problem of the white group headings.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

jiglei,

The simple function I have added to your code colours the tabs - or, to be more precise, adds a coloured label to the tab. Does this help?:

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <GuiTab.au3>

#Region ### START Koda GUI section ### Form=c:\users\david\desktop\autoit\sbot manager.kxf
$Form2 = GUICreate("Form1", 449, 303, 365, 173)
GUISetBkColor(0xC4C4C4)
$Tab1 = GUICtrlCreateTab(0, 0, 448, 297)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("Window 1")
_GUICtrlTab_SetBkColor($Form2, $Tab1, 0xFF0000)
$Group1 = GUICtrlCreateGroup("Char Data", 8, 32, 433, 105)
$Label1 = GUICtrlCreateLabel("Char Name:", 16, 48, 60, 17)
$Label2 = GUICtrlCreateLabel("Name", 80, 48, 32, 17)
$Label3 = GUICtrlCreateLabel("Level:", 16, 64, 33, 17)
$Label4 = GUICtrlCreateLabel("lvl", 48, 64, 14, 17)
$Label5 = GUICtrlCreateLabel("Gold:", 16, 80, 29, 17)
$Label6 = GUICtrlCreateLabel("0", 48, 80, 10, 17)
$Label7 = GUICtrlCreateLabel("SP:", 16, 96, 21, 17)
$Label8 = GUICtrlCreateLabel("0", 40, 96, 10, 17)
$Progress1 = GUICtrlCreateProgress(192, 48, 150, 24)
GUICtrlSetColor($Progress1, 0x00FF00)
$Label9 = GUICtrlCreateLabel("Exp:", 160, 56, 25, 17)
$Label10 = GUICtrlCreateLabel("0%", 248, 52, 18, 17)
$Label11 = GUICtrlCreateLabel("HP:", 160, 80, 22, 17)
$Label12 = GUICtrlCreateLabel("MP:", 160, 104, 23, 17)
$Progress2 = GUICtrlCreateProgress(192, 80, 150, 16)
GUICtrlSetColor($Progress2, 0xFF0000)
$Progress3 = GUICtrlCreateProgress(192, 104, 150, 16)
GUICtrlSetColor($Progress3, 0x0000FF)
$Label13 = GUICtrlCreateLabel("0%", 248, 82, 18, 17)
$Label14 = GUICtrlCreateLabel("0%", 248, 106, 18, 17)
$Label17 = GUICtrlCreateLabel("Bot Status:", 16, 112, 56, 17)
$Label18 = GUICtrlCreateLabel("none", 72, 112, 28, 17)
$Button9 = GUICtrlCreateButton("test", 360, 72, 75, 25, $WS_GROUP)
$Group2 = GUICtrlCreateGroup("Managing", 8, 136, 433, 97)
$Button1 = GUICtrlCreateButton("Hide Window", 16, 160, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Button2 = GUICtrlCreateButton("Show Window", 16, 184, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Button3 = GUICtrlCreateButton("Start Training", 104, 160, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Button4 = GUICtrlCreateButton("StopTraining", 104, 184, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Button5 = GUICtrlCreateButton("Show/Hide Client", 192, 160, 91, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Button6 = GUICtrlCreateButton("Save settings", 296, 160, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Button7 = GUICtrlCreateButton("Change Script", 192, 184, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Group3 = GUICtrlCreateGroup("Set Radius", 288, 184, 121, 41)
GUICtrlCreateInput("", 318, 198, 57, 21)
$Button8 = GUICtrlCreateButton("Close Window", 16, 208, 75, 17, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP))
$Group4 = GUICtrlCreateGroup("Notifications", 8, 232, 433, 57)
$Checkbox1 = GUICtrlCreateCheckbox("Play a sound when this character DC", 16, 248, 201, 17)
$Label15 = GUICtrlCreateLabel("Last recieved PM time:", 16, 264, 112, 17)
$Label16 = GUICtrlCreateLabel("[HH:MM:SS]", 128, 264, 64, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1

    If GUIGetMsg() = -3 Then Exit

WEnd

Func _GUICtrlTab_SetBkColor($hWnd, $hSysTab32, $sBkColor)
    Local $aTabPos = ControlGetPos($hWnd, "", $hSysTab32)

    Local $aTab_Rect = _GUICtrlTab_GetItemRect($hSysTab32, -1)

    GUICtrlCreateLabel("", $aTabPos[0]+2, $aTabPos[1]+$aTab_Rect[3]+4, $aTabPos[2]-6, $aTabPos[3]-$aTab_Rect[3]-7)
    GUICtrlSetBkColor(-1, $sBkColor)
    GUICtrlSetState(-1, $GUI_DISABLE)
EndFunc

I think you will have to change the Windows Appearance to solve the problem of the white group headings.

M23

Thanks a lot, that does all i needed >_<

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0