ranhalt Posted December 29, 2009 Share Posted December 29, 2009 I've got my tabbed environment working, but I don't like the white background, since I'm using bottom tabs and it looks weird. GUISetBkColor will change the background color of my GUI, but not the tab area. Any function to change it to anything else, like the standard grey? Link to comment Share on other sites More sharing options...
Yashied Posted December 29, 2009 Share Posted December 29, 2009 One of the ways...#Include <WinAPIEx.au3> Opt('MustDeclareVars', 1) Global $hForm, $Theme = _WinAPI_GetThemeAppProperties() $hForm = GUICreate('MyGUI', 310, 360) GUISetFont(8.5, 400, 0, 'MS Shell Dlg', $hForm) GUICtrlCreateGroup('Group', 10, 10, 140, 95) GUICtrlCreateCheckbox('Check1', 22, 26, 120, 23) GUICtrlCreateCheckbox('Check2', 22, 49, 120, 23) GUICtrlCreateCheckbox('Check3', 22, 72, 120, 23) GUICtrlCreateGroup('Group', 160, 10, 140, 95) GUICtrlCreateRadio('Radio1', 172, 26, 120, 23) GUICtrlCreateRadio('Radio2', 172, 49, 120, 23) GUICtrlCreateRadio('Radio3', 172, 72, 120, 23) GUICtrlCreateButton('OK', 120, 330, 70, 23) _WinAPI_SetThemeAppProperties($STAP_ALLOW_NONCLIENT) GUICtrlCreateTab(10, 118, 292, 206) GUICtrlCreateTabItem('Tab1') GUICtrlCreateTabItem('Tab2') GUICtrlCreateTabItem('') _WinAPI_SetThemeAppProperties($Theme) GUISetState() Do Until GUIGetMsg() = -3WinAPIEx.au3 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
MadMaxx Posted June 14, 2010 Share Posted June 14, 2010 I have an additional question. I have 3 tabs which I would like to make 3 different colours. Is this possible? M Link to comment Share on other sites More sharing options...
Authenticity Posted June 14, 2010 Share Posted June 14, 2010 I believe that you can subclass the tab controls and handle their WM_ERASEBKGND event to draw the back ground. Another possibility is to use owner-drawn tab control. You can also use this -inefficient hack- trick:expandcollapse popup#include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Local Const $FLOODFILLBORDER = 0 Local Const $FLOODFILLSURFACE = 1 Local $hGUI, $hDC, $Tab, $hTab, $Tab1, $Tab2, $Tab3 GUIRegisterMsg($WM_PAINT, "_WM_PAINT") $hGUI = GUICreate("Test", 300, 300) $Tab = GUICtrlCreateTab(0, 0, 300, 300) $hTab = GUICtrlGetHandle($Tab) $hDC = _WinAPI_GetDC($hTab) $Tab1 = GUICtrlCreateTabItem("Tab 1") GUICtrlCreateEdit("", 10, 30, 280, 220) GUICtrlCreateButton("Button 1", 115, 260, 70, 25) $Tab2 = GUICtrlCreateTabItem("Tab 2") GUICtrlCreateEdit("", 10, 30, 280, 220) GUICtrlCreateButton("Button 2", 115, 260, 70, 25) $Tab3 = GUICtrlCreateTabItem("Tab 3") GUICtrlCreateEdit("", 10, 30, 280, 220) GUICtrlCreateButton("Button 3", 115, 260, 70, 25) GUICtrlCreateTabItem("") GUISetState() _FillTabBackground($hDC, 0xFF0000, 5, 25) While 1 Switch GUIGetMsg() Case $Tab Switch GUICtrlRead($Tab, 1) Case $Tab1 _WinAPI_RedrawWindow($hGUI) _FillTabBackground($hDC, 0xFF0000, 5, 25) Case $Tab2 _WinAPI_RedrawWindow($hGUI) _FillTabBackground($hDC, 0x00FF00, 5, 25) Case $Tab3 _WinAPI_RedrawWindow($hGUI) _FillTabBackground($hDC, 0x0000FF, 5, 25) EndSwitch Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd _WinAPI_ReleaseDC($hTab, $hDC) GUIDelete() Func _WinAPI_ExtFloodFill($hDC, $iX, $iY, $iColor, $iFillType) Local $aResult = DllCall("gdi32.dll", "int", "ExtFloodFill", "hwnd", $hDC, "int", $iX, "int", $iY, "uint", _RGB($iColor), "uint", $iFillType) If @error Then Return SetError(@error, @extended, 0) Return $aResult[0] <> 0 EndFunc Func _FillTabBackground($hDC, $iColor, $iX, $iY) Local $hBrush, $hOldBrush $hBrush = _WinAPI_CreateSolidBrush(_RGB($iColor)) $hOldBrush = _WinAPI_SelectObject($hDC, $hBrush) _WinAPI_ExtFloodFill($hDC, $iX, $iY, 0xD4D0C8, $FLOODFILLSURFACE) _WinAPI_SelectObject($hDC, $hOldBrush) _WinAPI_DeleteObject($hBrush) EndFunc Func _WM_PAINT($hWnd, $iMsg, $iwParam, $ilParam) Switch GUICtrlRead($Tab, 1) Case $Tab1 _WinAPI_RedrawWindow($hGUI, $RDW_ERASE) Sleep(10) _FillTabBackground($hDC, 0xFF0000, 5, 25) Case $Tab2 _WinAPI_RedrawWindow($hGUI, $RDW_ERASE) Sleep(10) _FillTabBackground($hDC, 0x00FF00, 5, 25) Case $Tab3 _WinAPI_RedrawWindow($hGUI, $RDW_ERASE) Sleep(10) _FillTabBackground($hDC, 0x0000FF, 5, 25) EndSwitch Return $GUI_RUNDEFMSG EndFunc Func _RGB($iColor) Return Dec(Hex(BinaryMid($iColor, 1, 3))) EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 14, 2010 Moderators Share Posted June 14, 2010 MadMaxx, 3 tabs which I would like to make 3 different coloursHere is my take on how you might do it: #include <GUIConstantsEx.au3> #include <GuiTab.au3> $hGUI = GUICreate("Test", 500, 500) $hTab_1 = GUICtrlCreateTab(10, 10, 230, 90) $hTab_10 = GUICtrlCreateTabitem("Red") _GUICtrlTab_SetBkColor($hGUI, $hTab_1, 0xFFCCCC) $hTab_11 = GUICtrlCreateTabitem("Green") _GUICtrlTab_SetBkColor($hGUI, $hTab_1, 0xCCFFCC) $hTab_12 = GUICtrlCreateTabitem("Blue") _GUICtrlTab_SetBkColor($hGUI, $hTab_1, 0xCCCCFF) GUICtrlCreateTabitem ("") ; end tabitem definition GUISetState() GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch 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 M23 Atoxis and Norm73 1 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
MadMaxx Posted June 15, 2010 Share Posted June 15, 2010 Thanks M23 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 15, 2010 Moderators Share Posted June 15, 2010 MadMaxx, My pleasure. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
llewxam Posted July 19, 2010 Share Posted July 19, 2010 Just wanted to mention that I was very glad to find this Melba23, I have a nice blue background in my GUI and have never used CreateTab until today, I was SOOOOO upset with how my app looked because the background color was wrong. Thanks for this solution, very simple idea, I appreciate your expertise as always!! Ian Atoxis 1 My projects: IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged. INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them. PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses. Sync Tool - Folder sync tool with lots of real time information and several checking methods. USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions. Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized site agent. CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction. MyDirStat - Lists number and size of files on a drive or specified path, allows for deletion within the app. 2048 Game - My version of 2048, fun tile game. Juice Lab - Ecigarette liquid making calculator. Data Protector - Secure notes to save sensitive information. VHD Footer - Add a footer to a forensic hard drive image to allow it to be mounted or used as a virtual machine hard drive. Find in File - Searches files containing a specified phrase. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 20, 2010 Moderators Share Posted July 20, 2010 llewxam, Not mine, but I am afraid I have no idea who should really get the credit! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now