Tpanel con color

Tpanel con color

Postby carlos vargas » Wed Nov 28, 2018 5:02 pm

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)
User avatar
carlos vargas
 
Posts: 1688
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Tpanel con color

Postby hmpaquito » Wed Nov 28, 2018 5:22 pm

Un tip: Inténtalo con un brush.

Code: Select all  Expand view
oPanel:SetBrush(oBrush)
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Tpanel con color

Postby Antonio Linares » Wed Nov 28, 2018 5:28 pm

Carlos,

Prueba a modificar el método EraseBkGnd() de la Clase TPanel así:
Code: Select all  Expand view
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
User avatar
Antonio Linares
Site Admin
 
Posts: 41366
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Tpanel con color

Postby horacio » Wed Nov 28, 2018 5:57 pm

Este código funciona

Code: Select all  Expand view

#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
horacio
 
Posts: 1358
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: Tpanel con color

Postby carlos vargas » Wed Nov 28, 2018 10:39 pm

Funciona, gracias horacio.
Antonio, no hubo necesidad del cambio en la clase.
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
carlos vargas
 
Posts: 1688
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Tpanel con color

Postby Antonio Linares » Thu Nov 29, 2018 8:27 am

muy bien

gracias Horacio :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41366
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Tpanel con color

Postby James Bott » Thu Dec 13, 2018 1:22 am

Carlos,

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

Code: Select all  Expand view
#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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 28 guests