cashiba 发表于 2017-3-19 21:35:46

Group如何设置背景颜色?

本帖最后由 cashiba 于 2017-3-20 10:02 编辑

#include <GUIConstantsEx.au3>

Example()

Func Example()
    GUICreate("组框控件 GUI") ; 创建一个居中显示的对话框

    $iGroup=GUICtrlCreateGroup("组框 1", 190, 60, 90, 140)
    GUICtrlCreateRadio("单选框 1", 210, 90, 50, 20)
    GUICtrlCreateRadio("单选框 2", 210, 110, 60, 50)
    GUICtrlCreateGroup("", -99, -99, 1, 1) ;关闭组框控件
        GUICtrlSetBkColor($iGroup,0xFF0000)
        GUICtrlSetColor($iGroup,0xFFFFFF)
    GUISetState(@SW_SHOW) ; 显示对话框

    ; 循环到用户退出.
    While 1
      Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
      EndSwitch
    WEnd
EndFunc   ;==>Example如上,设置Group框的背景颜色,但是发现GUICtrlSetBkColor($iGroup,0xFF0000)改变的只是group标题框的背景.....

虫子樱桃 发表于 2017-3-20 16:33:44

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

StyleToggle(1 )
$Form1_1 = GUICreate("Amortization Plus" , 644 , 303 , 207 , 200 )
GUISetBkColor(0x000080 )
$Group1 = GUICtrlCreateGroup("Amortization Table" , 8 , 0 , 625 , 81 , BitOR($BS_CENTER, $BS_FLAT))
GUICtrlSetColor(-1 , 0xFFFFFF )
GUICtrlSetFont(-1 , 10 , 400 , 0 , "System" )
StyleToggle(0 )
GUISetState(@SW_SHOW )
While 1
      $nMsg = GUIGetMsg()
      Switch $nMsg
               Case $GUI_EVENT_CLOSE
                      Exit
      EndSwitch
WEnd

Func StyleToggle( $Off = 1)
      If Not StringInStr( @OSType, "WIN32_NT") Then Return 0
      $XS_n = DllCall("uxtheme.dll" , "int" , "GetThemeAppProperties" )
      If $Off Then
               DllCall("uxtheme.dll" , "none" , "SetThemeAppProperties" , "int" , 0 )
               Return 1
      ElseIf IsArray( $XS_n) Then
               DllCall("uxtheme.dll" , "none" , "SetThemeAppProperties" , "int" , $XS_n)
               $XS_n = ""
               Return 1
      EndIf
      Return 0
EndFunc   ;==>StyleToggle

邪恶海盗 发表于 2017-3-19 22:19:02

不了解,表示如果实在不行可以考虑在Group的位置先创建一个带颜色的lable为背景...

cashiba 发表于 2017-3-20 10:03:33

不了解,表示如果实在不行可以考虑在Group的位置先创建一个带颜色的lable为背景...
邪恶海盗 发表于 2017-3-19 22:19 http://www.autoitx.com/images/common/back.gif
这样就复杂化了...
像标题居中可以使用$bs_center,是不是也有其它啥简单的方法呢?

lin6051 发表于 2017-3-20 13:33:44

我知道的 只能 设置 窗口的背景,group 用窗口的背景GUISetBkColor

cashiba 发表于 2017-3-20 16:03:03

我知道的 只能 设置 窗口的背景,group 用窗口的背景GUISetBkColor
lin6051 发表于 2017-3-20 13:33 http://www.autoitx.com/images/common/back.gif
用GUISetBkColor来设置group框内的颜色?
{:face (396):}

zpmc123 发表于 2017-3-20 20:37:02

回复 6# 虫子樱桃


    如果底色是白色的话,就没有效果了

zpmc123 发表于 2017-3-20 20:38:49

回复 7# zpmc123


    在普通的窗口让Group框改变成其它颜色

zpmc123 发表于 2017-3-20 20:41:10

我想楼主是想在普通的窗口改变 Group框为任意颜色,等会上个图让虫子看一下

zpmc123 发表于 2017-3-20 20:46:03

我估计这个效果够呛



cashiba 发表于 2017-3-21 19:51:39


虫子樱桃 发表于 2017-3-20 16:33 http://www.autoitx.com/images/common/back.gif
主要是想设置Group框线范围内的背景颜色.....
记得曾经看过樱桃大神的AU3教程,在此表示感谢!
{:face (88):}

cashiba 发表于 2017-3-21 19:52:45

我估计这个效果够呛
zpmc123 发表于 2017-3-20 20:46 http://www.autoitx.com/images/common/back.gif
框线的颜色也能设置?效果也不错哇
怎么做到的?

black丶shark 发表于 2017-3-24 08:47:29

好高大上的样子。

lin6051 发表于 2017-3-24 09:01:17

回复 12# cashiba


   估计是 画图工具 画上去的{:face (197):}

cashiba 发表于 2017-3-24 23:11:27

回复cashiba
估计是 画图工具 画上去的
lin6051 发表于 2017-3-24 09:01 http://www.autoitx.com/images/common/back.gif
好像论坛里有类似的改变框线颜色的帖子,就是不太好搜....
页: [1] 2
查看完整版本: Group如何设置背景颜色?