andygo Posted March 5, 2011 Share Posted March 5, 2011 (edited) Hello,i know how to set the Textcolor of a "GUICtrlCreateGroup". But is it also possible to set the color of the BorderLines? Edited March 6, 2011 by andygo Link to comment Share on other sites More sharing options...
guinness Posted March 5, 2011 Share Posted March 5, 2011 (edited) Creates a GUICtrlCreateGroup() with the ability to set the color. or continue for those interested in a simple GUICtrlCreateGroup() ...Function:#include <StringSize.au3> Func _GUICtrlCreateGroup($sText, $iLeft, $iTop, $iWidth, $iHeight, $bColor = 0x000000) Local $aLabel[6] = [5] Local $aStringSize = _StringSize($sText) $aLabel[1] = GUICtrlCreateLabel('', $iLeft + 1, $iTop + 1, 1, $iHeight) ; Left Line. $aLabel[2] = GUICtrlCreateLabel('', $iLeft + 1, $iTop + 1, 10, 1) ; Top Left Line. GUICtrlCreateLabel(' ' & $sText, $iLeft + 7, $iTop - 6, $aStringSize[2] - 3, 15) $aLabel[3] = GUICtrlCreateLabel('', $iLeft + $aStringSize[2] + 4, $iTop + 1, $iWidth - $aStringSize[2] - 3, 1) ; Top Right Line. $aLabel[4] = GUICtrlCreateLabel('', $iLeft + $iWidth + 1, $iTop + 1, 1, $iHeight) ; Right Line. $aLabel[5] = GUICtrlCreateLabel('', $iLeft + 1, $iTop + $iHeight + 1, $iWidth + 1, 1) ; Bottom Line. For $i = 1 To $aLabel[0] GUICtrlSetBkColor($aLabel[$i], $bColor) Next EndFunc ;==>_GUICtrlCreateGroup Func _GUICtrlCreateGroupEx($sText, $iLeft, $iTop, $iWidth, $iHeight, $bColor = 0xC0C0C0, $OutlineColor = 0xFFFFFF) Local $aLabel[6] = [5], $aLabelInner[6] = [5] Local $aStringSize = _StringSize($sText) $aLabel[1] = GUICtrlCreateLabel('', $iLeft + 1, $iTop + 1, 1, $iHeight) ; Left Line. $aLabelInner[1] = GUICtrlCreateLabel('', $iLeft + 2, $iTop + 1, 1, $iHeight) ; Inner/Outer Left Line. $aLabel[2] = GUICtrlCreateLabel('', $iLeft + 1, $iTop + 1, 10, 1) ; Top Left Line. $aLabelInner[2] = GUICtrlCreateLabel('', $iLeft + 2, $iTop + 2, 10 - 1, 1) ; Top Inner/Outer Left Line. GUICtrlCreateLabel(' ' & $sText, $iLeft + 7, $iTop - 6, $aStringSize[2] - 3, 15) $aLabel[3] = GUICtrlCreateLabel('', $iLeft + $aStringSize[2] + 4, $iTop + 1, $iWidth - $aStringSize[2] - 3, 1) ; Top Right Line. $aLabelInner[3] = GUICtrlCreateLabel('', $iLeft + $aStringSize[2] + 4, $iTop + 2, $iWidth - $aStringSize[2] - 3, 1) ; Top Inner/Outer Right Line. $aLabel[4] = GUICtrlCreateLabel('', $iLeft + $iWidth + 1, $iTop + 1, 1, $iHeight) ; Right Line. $aLabelInner[4] = GUICtrlCreateLabel('', $iLeft + $iWidth + 2, $iTop + 1, 1, $iHeight + 1) ; Right Inner/Outer Line. $aLabel[5] = GUICtrlCreateLabel('', $iLeft + 1, $iTop + $iHeight + 1, $iWidth + 1, 1) ; Bottom Line. $aLabelInner[5] = GUICtrlCreateLabel('', $iLeft + 1, $iTop + $iHeight + 2, $iWidth + 2, 1) ; Bottom Inner/Outer Line. For $i = 1 To $aLabel[0] GUICtrlSetBkColor($aLabel[$i], $bColor) GUICtrlSetBkColor($aLabelInner[$i], $OutlineColor) Next EndFunc ;==>_GUICtrlCreateGroupExExample use of Function:#include <GUIConstantsEx.au3> #include <StringSize.au3> Example() Func Example() Local $hGUI = GUICreate('_GUICtrlCreateGroup()') _GUICtrlCreateGroupEx('Group 1', 10, 10, 200, 140) ; Default Colors. GUICtrlCreateRadio('Radio 1', 15, 25, 60, 20) GUICtrlCreateRadio('Radio 2', 15, 45, 60, 20) _GUICtrlCreateGroupEx('Group 2', 10, 160, 230, 100, 0x48036F, 0xAD66D5) GUICtrlCreateRadio('Radio 3', 15, 175, 60, 20) GUICtrlCreateRadio('Radio 4', 15, 195, 60, 20) _GUICtrlCreateGroup('Group 3', 10, 275, 100, 50, 0xA64A00) GUICtrlCreateRadio('Radio 5', 15, 290, 60, 20) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example Edited October 8, 2012 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
andygo Posted March 6, 2011 Author Share Posted March 6, 2011 hello, thanks for the reply. i had a similar idea. will test a bit around. maybe it is combinable with "_GDIPlus_GraphicsMeasureString" to get the text-string length and create flexible top-left and top-right lines. regards, andy Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 6, 2011 Moderators Share Posted March 6, 2011 andygo,If you want to measure the size of text strings, look at the StringSize UDF in my sig. 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...
andygo Posted March 6, 2011 Author Share Posted March 6, 2011 (edited) andygo, If you want to measure the size of text strings, look at the StringSize UDF in my sig. M23 hello, perfect combination. this is exactly what i want! #include <GUIConstantsEx.au3> #include "StringSize.au3" $sText = "Grouptext flexi color length" $hGUI = GUICreate("Test", 300, 200) $aSize = _StringSize($sText) _GUICtrlCreateGroup($stext, 10, 10, 200, 140) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _GUICtrlCreateGroup($sText, $iLeft, $iTop, $iWidth, $iHeight, $bColor = 0xff0000) Local $aLabel[6] = [5] $aLabel[1] = GUICtrlCreateLabel("", $iLeft + 1, $iTop + 1, 1, $iHeight) ; Left Line. $aLabel[2] = GUICtrlCreateLabel("", $iLeft + 1, $iTop + 1, 7, 1) ; Top Left Line. GUICtrlCreateLabel(" "&$sText, $iLeft + 7, $iTop - 6, $aSize[2]-3, 15);$aSize[3]) GUICtrlSetColor(-1, 0x0000ff); optional text color GUICtrlSetbkColor(-1, 0xffff00); optional text bg color $aLabel[3] = GUICtrlCreateLabel("", $iLeft + $aSize[2]+4, $iTop + 1, $iWidth-$aSize[2]-4, 1) ; Top Right Line. $aLabel[4] = GUICtrlCreateLabel("", $iLeft + $iWidth, $iTop + 1, 1, $iHeight) ; Right Line. $aLabel[5] = GUICtrlCreateLabel("", $iLeft + 1, $iTop + $iHeight + 1, $iWidth, 1) ; Bottom Line. For $i = 1 To $aLabel[0] GUICtrlSetBkColor($aLabel[$i], $bColor) Next EndFunc ;==>_GUICtrlCreateGroup Edited March 6, 2011 by andygo Link to comment Share on other sites More sharing options...
guinness Posted March 6, 2011 Share Posted March 6, 2011 That was my plan today, add StringSize.au3 by Melba23, but andygo you beat me to it. Thanks Melba for suggesting too. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
andygo Posted March 6, 2011 Author Share Posted March 6, 2011 That was my plan today, add StringSize.au3 by Melba23, but andygo you beat me to it. Thanks Melba for suggesting too.you anyway could do another modification to your function if you take a look to a zoomed "original" guictrlcreategroup,you will see the main-line and a second white line (on normalsize maybe this is for a shadowlook). Link to comment Share on other sites More sharing options...
guinness Posted March 6, 2011 Share Posted March 6, 2011 (edited) Function:#include <StringSize.au3> Func _GUICtrlCreateGroup($sText, $iLeft, $iTop, $iWidth, $iHeight, $bColor = 0x000000) Local $aLabel[6] = [5] Local $aStringSize = _StringSize($sText) $aLabel[1] = GUICtrlCreateLabel('', $iLeft + 1, $iTop + 1, 1, $iHeight) ; Left Line. $aLabel[2] = GUICtrlCreateLabel('', $iLeft + 1, $iTop + 1, 10, 1) ; Top Left Line. GUICtrlCreateLabel(' ' & $sText, $iLeft + 7, $iTop - 6, $aStringSize[2] - 3, 15) $aLabel[3] = GUICtrlCreateLabel('', $iLeft + $aStringSize[2] + 4, $iTop + 1, $iWidth - $aStringSize[2] - 3, 1) ; Top Right Line. $aLabel[4] = GUICtrlCreateLabel('', $iLeft + $iWidth + 1, $iTop + 1, 1, $iHeight) ; Right Line. $aLabel[5] = GUICtrlCreateLabel('', $iLeft + 1, $iTop + $iHeight + 1, $iWidth + 1, 1) ; Bottom Line. For $i = 1 To $aLabel[0] GUICtrlSetBkColor($aLabel[$i], $bColor) Next EndFunc ;==>_GUICtrlCreateGroup Func _GUICtrlCreateGroupEx($sText, $iLeft, $iTop, $iWidth, $iHeight, $bColor = 0xC0C0C0, $OutlineColor = 0xFFFFFF) Local $aLabel[6] = [5], $aLabelInner[6] = [5] Local $aStringSize = _StringSize($sText) $aLabel[1] = GUICtrlCreateLabel('', $iLeft + 1, $iTop + 1, 1, $iHeight) ; Left Line. $aLabelInner[1] = GUICtrlCreateLabel('', $iLeft + 2, $iTop + 1, 1, $iHeight) ; Inner/Outer Left Line. $aLabel[2] = GUICtrlCreateLabel('', $iLeft + 1, $iTop + 1, 10, 1) ; Top Left Line. $aLabelInner[2] = GUICtrlCreateLabel('', $iLeft + 2, $iTop + 2, 10 - 1, 1) ; Top Inner/Outer Left Line. GUICtrlCreateLabel(' ' & $sText, $iLeft + 7, $iTop - 6, $aStringSize[2] - 3, 15) $aLabel[3] = GUICtrlCreateLabel('', $iLeft + $aStringSize[2] + 4, $iTop + 1, $iWidth - $aStringSize[2] - 3, 1) ; Top Right Line. $aLabelInner[3] = GUICtrlCreateLabel('', $iLeft + $aStringSize[2] + 4, $iTop + 2, $iWidth - $aStringSize[2] - 3, 1) ; Top Inner/Outer Right Line. $aLabel[4] = GUICtrlCreateLabel('', $iLeft + $iWidth + 1, $iTop + 1, 1, $iHeight) ; Right Line. $aLabelInner[4] = GUICtrlCreateLabel('', $iLeft + $iWidth + 2, $iTop + 1, 1, $iHeight + 1) ; Right Inner/Outer Line. $aLabel[5] = GUICtrlCreateLabel('', $iLeft + 1, $iTop + $iHeight + 1, $iWidth + 1, 1) ; Bottom Line. $aLabelInner[5] = GUICtrlCreateLabel('', $iLeft + 1, $iTop + $iHeight + 2, $iWidth + 2, 1) ; Bottom Inner/Outer Line. For $i = 1 To $aLabel[0] GUICtrlSetBkColor($aLabel[$i], $bColor) GUICtrlSetBkColor($aLabelInner[$i], $OutlineColor) Next EndFunc ;==>_GUICtrlCreateGroupExExample use of Function:#include <GUIConstantsEx.au3> #include <StringSize.au3> Example() Func Example() Local $hGUI = GUICreate('_GUICtrlCreateGroup()') _GUICtrlCreateGroupEx('Group 1', 10, 10, 200, 140) ; Default Colors. GUICtrlCreateRadio('Radio 1', 15, 25, 60, 20) GUICtrlCreateRadio('Radio 2', 15, 45, 60, 20) _GUICtrlCreateGroupEx('Group 2', 10, 160, 230, 100, 0x48036F, 0xAD66D5) GUICtrlCreateRadio('Radio 3', 15, 175, 60, 20) GUICtrlCreateRadio('Radio 4', 15, 195, 60, 20) _GUICtrlCreateGroup('Group 3', 10, 275, 100, 50, 0xA64A00) GUICtrlCreateRadio('Radio 5', 15, 290, 60, 20) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example Edited October 8, 2012 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
andygo Posted March 6, 2011 Author Share Posted March 6, 2011 Something like this? >> expandcollapse popup#include <StringSize.au3> _Main() Func _Main() GUICreate("_GUICtrlCreateGroup()") _GUICtrlCreateGroup("Group 1", 10, 10, 200, 140) ; Default Colors. GUICtrlCreateRadio("Radio 1", 15, 25, 60, 20) GUICtrlCreateRadio("Radio 2", 15, 45, 60, 20) _GUICtrlCreateGroup("Group 2", 10, 160, 230, 100, 0x48036F, 0xAD66D5) GUICtrlCreateRadio("Radio 3", 15, 175, 60, 20) GUICtrlCreateRadio("Radio 4", 15, 195, 60, 20) _GUICtrlCreateGroup("Group 3", 10, 275, 100, 50, 0xA64A00, 0xFFB173) GUICtrlCreateRadio("Radio 5", 15, 290, 60, 20) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case -3 Exit EndSwitch WEnd EndFunc ;==>_Main Func _GUICtrlCreateGroup($sText, $iLeft, $iTop, $iWidth, $iHeight, $bColor = 0xC0C0C0, $OutlineColor = 0xFFFFFF) Local $aLabel[6] = [5], $aLabelInner[6] = [5] Local $aStringSize = _StringSize($sText) $aLabel[1] = GUICtrlCreateLabel("", $iLeft + 1, $iTop + 1, 1, $iHeight) ; Left Line. $aLabelInner[1] = GUICtrlCreateLabel("", $iLeft + 2, $iTop + 1, 1, $iHeight) ; Inner/Outer Left Line. $aLabel[2] = GUICtrlCreateLabel("", $iLeft + 1, $iTop + 1, 10, 1) ; Top Left Line. $aLabelInner[2] = GUICtrlCreateLabel("", $iLeft + 2, $iTop + 2, 10 - 1, 1) ; Top Inner/Outer Left Line. GUICtrlCreateLabel(" " & $sText, $iLeft + 7, $iTop - 6, $aStringSize[2] - 3, 15) $aLabel[3] = GUICtrlCreateLabel("", $iLeft + $aStringSize[2] + 4, $iTop + 1, $iWidth - $aStringSize[2] - 3, 1) ; Top Right Line. $aLabelInner[3] = GUICtrlCreateLabel("", $iLeft + $aStringSize[2] + 4, $iTop + 2, $iWidth - $aStringSize[2] - 3, 1) ; Top Inner/Outer Right Line. $aLabel[4] = GUICtrlCreateLabel("", $iLeft + $iWidth + 1, $iTop + 1, 1, $iHeight) ; Right Line. $aLabelInner[4] = GUICtrlCreateLabel("", $iLeft + $iWidth + 2, $iTop + 1, 1, $iHeight + 1) ; Right Inner/Outer Line. $aLabel[5] = GUICtrlCreateLabel("", $iLeft + 1, $iTop + $iHeight + 1, $iWidth + 1, 1) ; Bottom Line. $aLabelInner[5] = GUICtrlCreateLabel("", $iLeft + 1, $iTop + $iHeight + 2, $iWidth + 2, 1) ; Bottom Inner/Outer Line. For $i = 1 To $aLabel[0] GUICtrlSetBkColor($aLabel[$i], $bColor) GUICtrlSetBkColor($aLabelInner[$i], $OutlineColor) Next EndFunc ;==>_GUICtrlCreateGroup That's it, here we go Link to comment Share on other sites More sharing options...
Sven Posted October 27, 2014 Share Posted October 27, 2014 (edited) If the group name is too short, it's not getting displayed at all: #include <StringSize.au3> $Form1 = GUICreate("Test", 200, 200) _GUICtrlCreateGroupEx("short", 5, 15, 150, 150) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case -3 Exit EndSwitch WEnd Func _GUICtrlCreateGroupEx($sText, $iLeft, $iTop, $iWidth, $iHeight, $bColor = 0xC0C0C0, $OutlineColor = 0xFFFFFF) Local $aLabel[6] = [5], $aLabelInner[6] = [5] Local $aStringSize = _StringSize($sText) $aLabel[1] = GUICtrlCreateLabel('', $iLeft + 1, $iTop + 1, 1, $iHeight) ; Left Line. $aLabelInner[1] = GUICtrlCreateLabel('', $iLeft + 2, $iTop + 1, 1, $iHeight) ; Inner/Outer Left Line. $aLabel[2] = GUICtrlCreateLabel('', $iLeft + 1, $iTop + 1, 10, 1) ; Top Left Line. $aLabelInner[2] = GUICtrlCreateLabel('', $iLeft + 2, $iTop + 2, 10 - 1, 1) ; Top Inner/Outer Left Line. GUICtrlCreateLabel(' ' & $sText, $iLeft + 7, $iTop - 6, $aStringSize[2] - 3, 15) $aLabel[3] = GUICtrlCreateLabel('', $iLeft + $aStringSize[2] + 4, $iTop + 1, $iWidth - $aStringSize[2] - 3, 1) ; Top Right Line. $aLabelInner[3] = GUICtrlCreateLabel('', $iLeft + $aStringSize[2] + 4, $iTop + 2, $iWidth - $aStringSize[2] - 3, 1) ; Top Inner/Outer Right Line. $aLabel[4] = GUICtrlCreateLabel('', $iLeft + $iWidth + 1, $iTop + 1, 1, $iHeight) ; Right Line. $aLabelInner[4] = GUICtrlCreateLabel('', $iLeft + $iWidth + 2, $iTop + 1, 1, $iHeight + 1) ; Right Inner/Outer Line. $aLabel[5] = GUICtrlCreateLabel('', $iLeft + 1, $iTop + $iHeight + 1, $iWidth + 1, 1) ; Bottom Line. $aLabelInner[5] = GUICtrlCreateLabel('', $iLeft + 1, $iTop + $iHeight + 2, $iWidth + 2, 1) ; Bottom Inner/Outer Line. For $i = 1 To $aLabel[0] GUICtrlSetBkColor($aLabel[$i], $bColor) GUICtrlSetBkColor($aLabelInner[$i], $OutlineColor) Next EndFunc ;==>_GUICtrlCreateGroupEx Any idea how to fix this, besides adding a space after the group name? Edited October 27, 2014 by Sven Link to comment Share on other sites More sharing options...
jchomaz Posted June 23, 2020 Share Posted June 23, 2020 Hello Guys ! Thanks for this UDF ! Maybe i've a problem I'd make a hugh program and i would like to update the state of the group, some condition change color and some condition delete him or just hide. You know how i can do that ? I'd try with the GUICtrlDelete($nameofcontrol) but that won't work.. Probably because is isn't registered as a Ctrl... Or im maybe im totaly wrong .. Thank you dude ! Link to comment Share on other sites More sharing options...
Nine Posted June 23, 2020 Share Posted June 23, 2020 (edited) @jchomaz Did you notice that this thread is 9 years old ? I highly doubt that the creators are still here to reply. But since it is a very small UDF, I will answer you anyway. The short answer is : No. However it could quite easily be modified to add the features of hiding, deleting and showing (after hide). You would need to return an array of controls and pass this array to the new functions (hide, show, delete). Edited June 23, 2020 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy 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