Page 1 of 1
Tpanel con color
Posted: Wed Nov 28, 2018 5:02 pm
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
Re: Tpanel con color
Posted: Wed Nov 28, 2018 5:22 pm
by hmpaquito
Un tip: Inténtalo con un brush.
Re: Tpanel con color
Posted: Wed Nov 28, 2018 5:28 pm
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
Re: Tpanel con color
Posted: Wed Nov 28, 2018 5:57 pm
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
Re: Tpanel con color
Posted: Wed Nov 28, 2018 10:39 pm
by carlos vargas
Funciona, gracias horacio.
Antonio, no hubo necesidad del cambio en la clase.
Re: Tpanel con color
Posted: Thu Nov 29, 2018 8:27 am
by Antonio Linares
muy bien
gracias Horacio

Re: Tpanel con color
Posted: Thu Dec 13, 2018 1:22 am
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