Jump to content
Sign in to follow this  
orbs

label over graphic: can change font but not color

Recommended Posts

hello all,

i create a graphic rectangle, then i place a label in it. i can change the label font weight and background color, but i can not change the label text color.

this is a small reproducer:

#include <GUIConstantsEx.au3>

GUICreate('Block demo',400,200)
GUISetBkColor(0xCCDDEE)
GUICtrlCreateBlock('Title Of Block',20,20,300,100)
GUICtrlCreateLabel('Text Inside Block',25,50)
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
GUISetState()

Global $msg=0
While $msg<>$GUI_EVENT_CLOSE
    $msg=GUIGetMsg()
WEnd

Func GUICtrlCreateBlock($sTitle,$x,$y,$w,$h)
    Local Const $cOutline=0x000000
    Local Const $cBlockBG=0xFFFFFF
    Local Const $cTitle=0x0000EE
    Local Const $cTitleBG=0x999999
    GUICtrlCreateGraphic($x-1,$y-1,$w+2,$h+2)
    GUICtrlSetState(-1,$GUI_DISABLE)
    GUICtrlSetGraphic(-1,$GUI_GR_COLOR,$cOutline,$cTitleBG)
    GUICtrlSetGraphic(-1,$GUI_GR_RECT,-1,-1,$w+2,27)
    GUICtrlSetGraphic(-1,$GUI_GR_COLOR,$cOutline,$cBlockBG)
    GUICtrlSetGraphic(-1,$GUI_GR_RECT,-1,25,$w+2,$h+2-25)
    GUICtrlCreateLabel($sTitle,$x+5,$y+3,$w-10,20)
    GUICtrlSetFont(-1,8.5,800)
    GUICtrlSetColor(-1,$cTitle)
    GUICtrlSetBkColor(-1,$cTitleBG)
    GUICtrlSetState(-1,$GUI_DISABLE)
EndFunc
 

this is the result: the label text color is shady white, while it should be blue:

post-47848-0-04454500-1379183391_thumb.p

what am i doing wrong?

 

Share this post


Link to post
Share on other sites

U forgot to change GUICtrlSetState(-1,$GUI_DISABLE) to GUICtrlSetState(-1,$GUI_ENABLE)

#include <GUIConstantsEx.au3>

GUICreate('Block demo',400,200)
GUISetBkColor(0xCCDDEE)
GUICtrlCreateBlock('Title Of Block',20,20,300,100)
GUICtrlCreateLabel('Text Inside Block',25,50)
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
GUISetState()

Global $msg=0
While $msg<>$GUI_EVENT_CLOSE
    $msg=GUIGetMsg()
WEnd

Func GUICtrlCreateBlock($sTitle,$x,$y,$w,$h)
    Local Const $cOutline=0x000000
    Local Const $cBlockBG=0xFFFFFF
    Local Const $cTitle=0x0000EE
    Local Const $cTitleBG=0x999999
    GUICtrlCreateGraphic($x-1,$y-1,$w+2,$h+2)
    GUICtrlSetState(-1,$GUI_DISABLE)
    GUICtrlSetGraphic(-1,$GUI_GR_COLOR,$cOutline,$cTitleBG)
    GUICtrlSetGraphic(-1,$GUI_GR_RECT,-1,-1,$w+2,27)
    GUICtrlSetGraphic(-1,$GUI_GR_COLOR,$cOutline,$cBlockBG)
    GUICtrlSetGraphic(-1,$GUI_GR_RECT,-1,25,$w+2,$h+2-25)
    GUICtrlCreateLabel($sTitle,$x+5,$y+3,$w-10,20)
    GUICtrlSetFont(-1,8.5,800)
    GUICtrlSetColor(-1,$cTitle)
    GUICtrlSetBkColor(-1,$cTitleBG)
    GUICtrlSetState(-1,$GUI_ENABLE)
EndFunc

:D

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...