Cambio color ribbon (SOLUCIONADO)

Post Reply
User avatar
leandro
Posts: 958
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia
Contact:

Cambio color ribbon (SOLUCIONADO)

Post by leandro »

Buenos días para todos,

Compile un ejemplo que encontré en el foro para el cambio de los colores de una ribbon, he logrado identificar algunos de objetos para el cambio del color, pero no logro cambiar el color negro de la parte superior de la barra ribbon, esta señalada en la imagen, así como tampoco las líneas que separan los paneles.

De antemano gracias.

Image

Code: Select all

/*
Purpose  : Fivewin Ribbonbar - MS Office 2019 style
Program  :
Author   : Frances Padilla (FAP)
Date     : 05/07/2019 04:52:26 PM
Company  :
Copyright:
Language : Fivewin/xHarbour
Updated  : 05/06/2019 By James Bott, jbott@compuserve.com
Notes    :
Source   : viewtopic.php?f=3&t=36145&p=221601#p221601
         : This is the dark theme
         : Somehow he got rid of the underline under the ribbonbar.

*/

#include "FiveWin.ch"
#include "Ribbon.ch"

//#define _ClrRed RGB(255,37,37)

#define _nClrPaneRB       RGB( 68, 68, 68 )  //COLOR DE LA BARRA INFERIOR VENTANA  SUPERIOR RIBBON BORDES BARRA
#define _nClrBoxOutRB     RGB( 0, 120, 212) //LINEA DEL BORDE ACTIVO DE LA BARRA
#define _nClrBoxInRB      RGB( 0, 120, 212 ) //LINEA INTERNA DE LA BARRA
#define _nClrBoxSelOut    RGB( 0, 120, 212 )  // BORDE DE LA PESTAÑA AL PASAR EL MOUSE POR ENCIMA CUANDO PESTAÑA ACTIVA
#define _nClrBoxSelIn  := RGB( 0, 120, 212 )
#define _aGradRB          { { 1, RGB( 0, 120, 212 ), RGB( 0, 120, 212 ) } } //COLORES DEGRADE INTERNA BARRA
#define _aGradFldRB       {|nOpt| iif( nOpt == oRibbon:nStart, { { 1, RGB( 0, 120, 212 ), RGB( 0, 120, 212 ) } },;
                                                                 { { 1, RGB( 0, 120, 212 ), RGB( 0, 120, 212 ) } } ) } //COLOR EN DEGRADE DE LA PESTAÑA 
#define _aGradHighRB      { { 1, RGB(0, 120, 212 ), RGB( 0, 120, 212 ) } } //DE MOMENTO NO LO IDENTIFIQUE
#define _aGradOverRB      { { 1, RGB( 0, 120, 212 ), RGB( 0, 120, 212 ) } } //DE MOMENTO NO LO IDENTIFIQUE
#define _nCtrlFrGround    RGB( 255, 255, 255 ) //DE MOMENTO NO LO IDENTIFIQUE
#define _nCtrlBkGround    RGB( 106, 106, 106 ) //FONDO DE LA VENTANA
#define _nClrBoxOut       RGB( 0, 120, 212 ) //DE MOMENTO NO LO IDENTIFIQUE
#define _nClrBoxIn        RGB( 0, 120, 212 ) //DE MOMENTO NO LO IDENTIFIQUE
#define _nClrTxt          RGB( 220, 220, 220 ) //COLOR DEL TEXTO
#define _bClrGradNormal   {|lPressed| iif( lPressed, { { 1, _nClrBoxOut, _nClrBoxOut } },;
                                                     { { 1, _nClrBoxOut, _nClrBoxOut } } ) }
#define _aClrGradUnder    {|| { { 1, _nClrBoxOut, _nClrBoxOut } } }
#define _aClrGradBack     { { 1, _nClrBoxOut, _nClrBoxOut } }


Function Main()

   local oFont
   local n, oWnd, oRibbon, oGroup
   local aDlgs, oDlg

   DEFINE FONT oFont NAME getSysFont() SIZE 0,-12

   DEFINE WINDOW oWnd title "Fivewin Ribbonbar - Office 2109 style"
   
        aDlgs := { ' File ', ' Home ', ' Insert ', ' Design ', ' Layout ', ' References ', ' Mailings ', ' Review ', ' View ' }

        oRibbon := TRibbonBar():New( oWnd, aDlgs,,,, 135, 40, _nClrPaneRB, _nClrBoxOutRB, _nClrBoxInRB,,;
        _nClrBoxSelOut, _aGradRB, _aGradFldRB, _aGradHighRB, _aGradOverRB,,,.t.,,)
                                    // _nClrBoxSelOut, _aGradRB, _aGradFldRB, _aGradHighRB, _aGradOverRB,,,,,.T.)
       
        // Change the colors of the tabs                            
        AFill( oRibbon:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, CLR_BLACK,;
       If( oRibbon:nOverPrompt( ScreenToClient( oRibbon:hWnd, GetCursorPos() )[ 1 ], ScreenToClient( oRibbon:hWnd, GetCursorPos() )[ 2 ] ) == nPrompt, CLR_BLACK, _nClrTxt ) ) } )
       
        WITH OBJECT oRibbon
            :nHeightFld := 24
            :hSeparation := 4
            :SetFont( oFont )
            :nLeftMargin = 10   // left margin of tabs
            :nClrBoxSelOut = _nClrBoxSelOut   // New ! Removes white outline of tab when cursor is over them.
            :l2010 = .T.   // New ! Turns off highlighting of groups when cursor is over them.
            :CalcPos()
        END
       
         oGroup = oRibbon:AddGroup( 70, "Clipboard", 1 )
            @ 5,5   ADD BUTTON oBtn PROMPT "MDI-button" BITMAP ""    GROUP oGroup ROUND SIZE 63,65 ACTION Msginfo("mdi2 button1")
            @ 5,70  ADD BUTTON oBtn1 PROMPT "MDI-button" BITMAP ""    GROUP oGroup ROUND SIZE 63,65 ACTION Msginfo("mdi2 button2")
         
            //oBtn:oFont:End()
            //oBtn:SetFont( oRb:oFont )
           
            //oBtn:nHeight       -= 24
            oBtn:bClrGradNormal = { | lPressed | If( lPressed, { { 1, RGB( 160, 160, 160 ), RGB( 160, 160, 160 ) } },;
                                                               { { 1, RGB( 160, 160, 160 ), RGB( 160, 160, 160 ) } } ) }
            oBtn:aClrGradUnder = { || { { 1, RGB( 255, 160, 160 ), RGB( 160, 160, 160 ) } } }  
            oBtn:aClrGradBack  = { { 1, RGB( 160, 160, 160 ), RGB( 160, 160, 160 ) } }
            oBtn:nClrBoxIn     = RGB( 160, 160, 160 )
            oBtn:nClrBoxOut    = RGB( 160, 160, 160 )        
         
         
         oGroup = oRibbon:AddGroup( 260, "Font", 1 )
         oGroup = oRibbon:AddGroup( 221, "Paragraph", 1 )
         oGroup = oRibbon:addGroup( 320, "Styles", 1)
         
         for each oDlg in oRibbon:aDialogs
           
            oDlg:hBack = oRibbon:hBrushEx
            oDlg:Refresh()
           
            for each oGroup in oDlg:aControls
               if oGroup:IsKindOf( "TRBGROUP" )
                  //oGroup:oFont:End()
                  //oGroup:SetFont( oRibbon:oFont )
                 
                 // oGroup:nHeight      = 100
                  oGroup:nClrBoxIn    = CLR_LIGHTGRAY
                  oGroup:aGradCaption = { { 1, CLR_LIGHTGRAY, CLR_LIGHTGRAY } }
                  //oGroup:bClrText     = { | lEnable | If( lEnable, CLR_LIGHTGRAY, CLR_DARKGRAY ) } //CLR_DARKGRAY ) }
                  oGroup:nClrTxt      = RGB(0,0,0)
                  oGroup:nClrBoxIn    = _nClrPaneRB //CLR_LIGHTGRAY
                  oGroup:nClrBoxOut   = _nClrPaneRB //CLR_LIGHTGRAY
                 
                  //oGroup:SetColor( _nClrTxt, _nClrPaneRB )
                 
                  DeleteObject( oGroup:hBrushSel )
                  DeleteObject( oGroup:hBrushUnSel )
                  DeleteObject( oGroup:hBack )
                  oGroup:hBrushUnSel  = oDlg:hBack
                  oGroup:hBack        = oDlg:hBack
                 
                  oGroup:refresh()
               endif
            next
          next        

        oWnd:SetSize( 930, 400 )
        oWnd:setColor(, _nCtrlBkGround)
        
        SET MESSAGE TO " Page 1 of 1 0 words English (United Kingdom)" OF oWnd color _nClrTxt, _nClrPaneRB noinset noborder

   ACTIVATE WINDOW oWnd CENTER
 
return nil
 
Last edited by leandro on Mon Jan 25, 2021 4:13 pm, edited 1 time in total.
Saludos
LEANDRO ALFONSO
SISTEMAS LYMA - BASE
Bogotá (Colombia)
[ FWH 19.09 ] [ xHarbour 1.2.3 Intl. (SimpLex) (Build 20190613) ] [ Embarcadero C++ 7.30 for Win32 ]
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Cambio color ribbon

Post by karinha »

Code: Select all

/*
Purpose  : Fivewin Ribbonbar - MS Office 2019 style
Program  :
Author   : Frances Padilla (FAP)
Date     : 05/07/2019 04:52:26 PM
Company  :
Copyright:
Language : Fivewin/xHarbour
Updated  : 05/06/2019 By James Bott, jbott@compuserve.com
Notes    :
Source   : viewtopic.php?f=3&t=36145&p=221601#p221601
         : This is the dark theme
         : Somehow he got rid of the underline under the ribbonbar.
Modified : 24/01/2021 - By Joao Santos - Sao Paulo - Brazil. 13:20 PM

*/

#Include "FiveWin.ch"
#Include "Ribbon.ch"

//#Define _ClrRed RGB(255,37,37)

#Define _nClrPaneRB       RGB( 68, 68, 68 )  //COLOR DE LA BARRA INFERIOR VENTANA  SUPERIOR RIBBON BORDES BARRA
#Define _nClrBoxOutRB     RGB( 0, 120, 212) //LINEA DEL BORDE ACTIVO DE LA BARRA
#Define _nClrBoxInRB      RGB( 0, 120, 212 ) //LINEA INTERNA DE LA BARRA
#Define _nClrBoxSelOut    RGB( 0, 120, 212 )  // BORDE DE LA PESTAÑA AL PASAR EL MOUSE POR ENCIMA CUANDO PESTAÑA ACTIVA
#Define _nClrBoxSelIn  := RGB( 0, 120, 212 )
#Define _aGradRB          { { 1, RGB( 0, 120, 212 ), RGB( 0, 120, 212 ) } } //COLORES DEGRADE INTERNA BARRA
#Define _aGradFldRB       {|nOpt| iif( nOpt == oRibbon:nStart, { { 1, RGB( 0, 120, 212 ), RGB( 0, 120, 212 ) } },;
      { { 1, RGB( 0, 120, 212 ), RGB( 0, 120, 212 ) } } ) } //COLOR EN DEGRADE DE LA PESTAÑA
#Define _aGradHighRB      { { 1, RGB(0, 120, 212 ), RGB( 0, 120, 212 ) } } //DE MOMENTO NO LO IDENTIFIQUE
#Define _aGradOverRB      { { 1, RGB( 0, 120, 212 ), RGB( 0, 120, 212 ) } } //DE MOMENTO NO LO IDENTIFIQUE
#Define _nCtrlFrGround    RGB( 255, 255, 255 ) //DE MOMENTO NO LO IDENTIFIQUE
#Define _nCtrlBkGround    RGB( 106, 106, 106 ) //FONDO DE LA VENTANA
#Define _nClrBoxOut       RGB( 0, 120, 212 ) //DE MOMENTO NO LO IDENTIFIQUE
#Define _nClrBoxIn        RGB( 0, 120, 212 ) //DE MOMENTO NO LO IDENTIFIQUE
#Define _nClrTxt          RGB( 220, 220, 220 ) //COLOR DEL TEXTO
#Define _bClrGradNormal   {|lPressed| iif( lPressed, { { 1, _nClrBoxOut, _nClrBoxOut } },;
      { { 1, _nClrBoxOut, _nClrBoxOut } } ) }
#Define _aClrGradUnder    {|| { { 1, _nClrBoxOut, _nClrBoxOut } } }
#Define _aClrGradBack     { { 1, _nClrBoxOut, _nClrBoxOut } }

FUNCTION Main()

   LOCAL oFont, oBtn, oBtn1
   LOCAL n, oWnd, oRibbon, oGroup
   LOCAL aDlgs, oDlg

   DEFINE FONT oFont NAME GetSysFont() SIZE 0, - 12 BOLD

   DEFINE WINDOW oWnd TITLE "Fivewin Ribbonbar - Office 2019 style"
   
   // aDlgs := { ' File ', ' Home ', ' Insert ', ' Design ', ' Layout ', ' References ', ' Mailings ', ' Review ', ' View ' }
   aDlgs := { ' File ', ' Home ', ' Insert ', ' Design ', ' Layout ', ;
              ' References ', ' Mailings ', ' Review ', ' View ' }

   /*
   oRibbon := TRibbonBar():New( oWnd, aDlgs, , , , 135, 40, _nClrPaneRB, _nClrBoxOutRB, _nClrBoxInRB, , ;
      _nClrBoxSelOut, _aGradRB, _aGradFldRB, _aGradHighRB, _aGradOverRB, , , .T. , , )
   */

   oRibbon := TRibbonBar():New( oWnd, aDlgs, , , , 135, 40, CLR_CYAN, CLR_HRED, CLR_HBLUE, , ;
      CLR_CYAN, _aGradRB, _aGradFldRB, _aGradHighRB, _aGradOverRB, , , .T. , , )

   // _nClrBoxSelOut, _aGradRB, _aGradFldRB, _aGradHighRB, _aGradOverRB,,,,,.T.)
       
   // Change the colors of the tabs

   AFill( oRibbon:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, CLR_BLACK,;
      If( oRibbon:nOverPrompt( ScreenToClient( oRibbon:hWnd, GetCursorPos() )[ 1 ],        ;
         ScreenToClient( oRibbon:hWnd, GetCursorPos() )[ 2 ] ) == nPrompt, CLR_BLACK, _nClrTxt ) ) } )

   WITH OBJECT oRibbon

      :nHeightFld := 24
      :hSeparation := 4
      :SetFont( oFont )
      :nLeftMargin = 10   // left margin of tabs

      // :nClrBoxSelOut = _nClrBoxSelOut   // New ! Removes white outline of tab when cursor is over them.
      :nClrBoxSelOut = CLR_YELLOW   // New ! Removes white outline of tab when cursor is over them.

      :l2010 = .T.   // New ! Turns off highlighting of groups when cursor is over them.

      :CalcPos()

   END
       
   oGroup = oRibbon:AddGroup( 70, "Clipboard", 1 )

   @ 5, 5   ADD BUTTON oBtn  PROMPT "MDI-button" BITMAP "" GROUP oGroup ROUND ;
      SIZE 63, 65 ACTION Msginfo( "mdi2 button1" )

   @ 5, 70  ADD BUTTON oBtn1 PROMPT "MDI-button" BITMAP "" GROUP oGroup ROUND ;
      SIZE 63, 65 ACTION Msginfo( "mdi2 button2" )
         
   // oBtn:oFont:End()
   // oBtn:SetFont( oRb:oFont )

   // oBtn:nHeight       -= 24
   oBtn:bClrGradNormal = { | lPressed | If( lPressed, { { 1, RGB( 160, 160, 160 ), RGB( 160, 160, 160 ) } }, ;
      { { 1, RGB( 160, 160, 160 ), RGB( 160, 160, 160 ) } } ) }

   oBtn:aClrGradUnder = { || { { 1, RGB( 255, 160, 160 ), RGB( 160, 160, 160 ) } } }
   oBtn:aClrGradBack  = { { 1, RGB( 160, 160, 160 ), RGB( 160, 160, 160 ) } }
   oBtn:nClrBoxIn     = RGB( 160, 160, 160 )
   oBtn:nClrBoxOut    = RGB( 160, 160, 160 )
         
   oGroup = oRibbon:AddGroup( 260, "Font", 1 )
   oGroup = oRibbon:AddGroup( 221, "Paragraph", 1 )
   oGroup = oRibbon:addGroup( 320, "Styles", 1 )
         
   FOR EACH oDlg in oRibbon:aDialogs
           
      oDlg:hBack = oRibbon:hBrushEx
      oDlg:Refresh()
           
      FOR EACH oGroup in oDlg:aControls

         IF oGroup:IsKindOf( "TRBGROUP" )

            // oGroup:oFont:End()
            // oGroup:SetFont( oRibbon:oFont )
                 
            // oGroup:nHeight      = 100
            oGroup:nClrBoxIn    = CLR_LIGHTGRAY
            oGroup:aGradCaption = { { 1, CLR_LIGHTGRAY, CLR_LIGHTGRAY } }
            // oGroup:bClrText     = { | lEnable | If( lEnable, CLR_LIGHTGRAY, CLR_DARKGRAY ) } //CLR_DARKGRAY ) }
            oGroup:nClrTxt      = RGB( 0, 0, 0 )
            oGroup:nClrBoxIn    = _nClrPaneRB //CLR_LIGHTGRAY

            oGroup:nClrBoxOut   = _nClrPaneRB //CLR_LIGHTGRAY
                 
            // oGroup:SetColor( _nClrTxt, _nClrPaneRB )
                 
            DeleteObject( oGroup:hBrushSel )
            DeleteObject( oGroup:hBrushUnSel )
            DeleteObject( oGroup:hBack )

            oGroup:hBrushUnSel  = oDlg:hBack
            oGroup:hBack        = oDlg:hBack
                 
            oGroup:refresh()

         ENDIF

      NEXT

   NEXT

   oWnd:SetSize( 930, 400 )

   // oWnd:SetColor( , _nCtrlBkGround )
   oWnd:SetColor( , CLR_YELLOW )  // WINDOW

   /*
   SET MESSAGE TO " Page 1 of 1 0 words English (United Kingdom)" OF oWnd ;
      COLOR _nClrTxt, _nClrPaneRB noinset noborder
   */

   SET MESSAGE TO " Page 1 of 1 0 words English (United Kingdom)" OF oWnd ;
      COLOR CLR_CYAN, CLR_WHITE NOINSET NOBORDER

   ACTIVATE WINDOW oWnd CENTERED
 
RETURN NIL
 
João Santos - São Paulo - Brasil
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Cambio color ribbon

Post by FranciscoA »

Leandro.
leandro wrote:pero no logro cambiar el color negro de la parte superior de la barra ribbon, esta señalada en la imagen,
Leandro.
Probablemente en versiones actuales algo haya cambiado, pero en mi version "viejita" lo hago asi:

Code: Select all

      oRBar:nClrPaneRB    := RGB( 191, 219, 255 )  // Clr Panel del menu 
Saludos.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
User avatar
leandro
Posts: 958
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia
Contact:

Re: Cambio color ribbon

Post by leandro »

Muchas gracias por las respuestas.

Ya quedo solucionado :D
Saludos
LEANDRO ALFONSO
SISTEMAS LYMA - BASE
Bogotá (Colombia)
[ FWH 19.09 ] [ xHarbour 1.2.3 Intl. (SimpLex) (Build 20190613) ] [ Embarcadero C++ 7.30 for Win32 ]
Post Reply