Jump to content

Background Of Label Control


jpm
 Share

Recommended Posts

I want to be able to have specific background color of a label control.

I modified the handling of WM_CTLCOLORSTATIC in application.cpp

case WM_CTLCOLORSTATIC:
     g_oGUI.SetColor((HDC) wParam, (HWND) lParam);
    /*  if (g_oGUI.m_nBackground != -1)
     {
    SetBkColor((HDC)wParam, g_oGUI.m_nBackground);
     }
     else
    SetBkColor((HDC)wParam,GetSysColor(COLOR_BTNFACE));
    */

and add special code in the gui class

void  CGuiBox::SetColor(HDC hdc, HWND hWnd)
{ 
    int nColor = GetSysColor(COLOR_BTNFACE);
    if (m_nBackground != -1)
  nColor= m_nBackground;

    int i= GetControlID(hWnd);
    if (i>0)
    {
  if (GUICtrl[i].nBackColor>0)
     nColor = GUICtrl[i].nBackColor;

  if (GUICtrl[i].nTextColor>0)
     SetTextColor(hdc, GUICtrl[i].nTextColor);
    }
    SetBkColor(hdc, nColor);

} // SetColor

I get the following result which does not fill the complete control area

the label have been created with the default value

Posted Image

Opt("GuiCoordMode", 2)

GUICreate("My GUI") ; will create a dialog box that when displayed is centered
GUICreateEx("",0xFFFFFF)

GUISetControl("label", "label1", 0,0,100,300)
GUISetControlEx(-1,-1,$GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM, "", 0x0,0xFF0000)
GUISetControl("label", "label2", 0,-1)
GUISetControlEx(-1,-1,$GUI_DOCKTOP+$GUI_DOCKBOTTOM, "", 0xFF,0xFF00)
GuiWaitClose()

I need some help in this last feature.

do I will just to create the label with special style or I need more code.?

Link to comment
Share on other sites

this new label color thing is french to me.... get it... ha ha.

OK, so .12 is final... now Jon needs to get this into unstable (beta) so we can have it released before May.

Lar.

Sorry English speaking people difficult to do your flag with just labels.

Larry,

Do you think it is possible to put label on label? I cannot have the latest defined displayed.

Link to comment
Share on other sites

in controlex() I did this...

if (GUICtrl[m_iCurCtrl].cType == GUI_LABEL)
    {
  if (nExt1 == -1 )
    GUICtrl[m_iCurCtrl].nTextColor = GetSysColor(COLOR_BTNTEXT);
  else
    GUICtrl[m_iCurCtrl].nTextColor = nExt1;

  if (nExt2 == -1 )
    GUICtrl[m_iCurCtrl].nBackColor = GetSysColor(COLOR_BTNFACE);
  else
    GUICtrl[m_iCurCtrl].nBackColor = nExt2;
    }

I think the GUIcolor.au3 is coded badly...

GUISetCoord(20,20)
GUISetControl("label", "label", 0,0)

or something...

if I do...

GUISetCoord(20,20)
GUISetControl("label", "label", 0,-1)

I see my label.

Thanks Larry, :whistle:

Since the source for 102 is uploaded perhahs not final but at least a good start I am going to generate 102.12

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...