Tpanel con color

Post Reply
User avatar
carlos vargas
Posts: 1421
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Tpanel con color

Post by carlos vargas »

Estimados, como puedo asignar un color a un panel?
como este hereda de tcontrols intento usar oPanel:SetColor(CLR_BLACK, CLR_BLACK) y no me funciona, necesito que al inicio el tpanel se muetre en negro
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
hmpaquito
Posts: 1200
Joined: Thu Oct 30, 2008 2:37 pm

Re: Tpanel con color

Post by hmpaquito »

Un tip: Inténtalo con un brush.

Code: Select all

oPanel:SetBrush(oBrush)
User avatar
Antonio Linares
Site Admin
Posts: 37485
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Tpanel con color

Post by Antonio Linares »

Carlos,

Prueba a modificar el método EraseBkGnd() de la Clase TPanel así:

Code: Select all

METHOD EraseBkGnd( hDC ) CLASS TPanel

   if ::oWnd != nil .and. IsAppThemed() .and. ;
      Upper( ::oWnd:ClassName() ) $ "TFOLDER,TFOLDEREX,TREBAR,TGROUP,TPANEL"
      DrawPBack( ::hWnd, hDC )
      return 1
   else
      ::PaintBack( hDC )
   endif

return 1
regards, saludos

Antonio Linares
www.fivetechsoft.com
horacio
Posts: 1270
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: Tpanel con color

Post by horacio »

Este código funciona

Code: Select all

#include "fivewin.ch"
Static oWnd
Static oPnl

//----------------------------------------------------------------------------//
Function Main()

    Define Window oWnd //Pixel
    
        @ 10, 10 Panel oPnl Size 500, 500 Of oWnd
        oPnl : SetColor( 0, 0 )
        oPnl : nOpacity  := 255
            
    Activate Window oWnd Maximized
    Return 0
 
Saludos
User avatar
carlos vargas
Posts: 1421
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Tpanel con color

Post by carlos vargas »

Funciona, gracias horacio.
Antonio, no hubo necesidad del cambio en la clase.
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
Antonio Linares
Site Admin
Posts: 37485
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Tpanel con color

Post by Antonio Linares »

muy bien

gracias Horacio :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Tpanel con color

Post by James Bott »

Carlos,

I have been using oPanel:setColor() for years without problem. Here is a working example.

Code: Select all

#include "fivewin.ch"
#include "colors.ch"

Function Main()
   Local oWnd
   
   Define window oWnd
   oPanel:= TPanel():new()
   oPanel:setColor(CLR_BLACK, CLR_BLACK)
   
   oWnd:oClient:= oPanel
   
   Activate window ownd 

Return nil
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Post Reply