Page 1 of 1

Dos preguntas dos sobre la clase METRO

PostPosted: Sun May 05, 2024 6:11 pm
by Armando
Amigos del foro:

Estoy picándole a la clase METRO y me surgen dos preguntas que pongo
en este foro:

1.- Donde obtener BITMAPS para la clase METRO, veo que hay algunos
en la carpeta ..\bitmaps\metro, pero me son insuficientes, y

2.- Es posible definir los BITMAPS desde recursos?

Saludos y gracias por el apoyo

Re: Dos preguntas dos sobre la clase METRO

PostPosted: Mon May 06, 2024 3:43 am
by Antonio Linares
Estimado Armando,

1. https://www.flaticon.com/
2. https://thenounproject.com/
3. https://designer.microsoft.com/
4. https://creativemarket.com/
5. https://elements.envato.com/

Este es el código de la Clase TMetro Método AddButton modificado para que soporte imágenes desde recursos:
Code: Select all  Expand view
METHOD AddButton( cCaption, nClrText, nClrPane, lLarge, cImgName, bAction ) CLASS TMetro

   local oBtn
   local nX := ::nOriginX + ( ::nRow * ( ::nBtnHeight + 8 ) )
   local nY := ::nOriginY + ( ::nCol * ( ::nBtnWidth + 8 ) )
   
   DEFAULT lLarge := .F.
   
   if File( cImgName )
      @ nX, nY BTNBMP oBtn ;
         SIZE ( ::nBtnWidth * If( lLarge, 2, 1 ) ) + If( lLarge, 8, 0 ), ::nBtnHeight ;
         OF ::oWnd PROMPT cCaption NOBORDER FILENAME cImgName
   else
      @ nX, nY BTNBMP oBtn ;
         SIZE ( ::nBtnWidth * If( lLarge, 2, 1 ) ) + If( lLarge, 8, 0 ), ::nBtnHeight ;
         OF ::oWnd PROMPT cCaption NOBORDER RESOURCE cImgName
   endif
     
   oBtn:bAction = bAction  
     
   oBtn:SetColor( nClrText, nClrPane )    
   
   AAdd( ::aButtons, oBtn )
   
   ::nCol++
   if lLarge
      ::nCol++
   endif  
   if ( ATail( ::aButtons ):nLeft + ATail( ::aButtons ):nWidth ) > ( ::nOriginY * 4 ) + 50
      ::nRow++
      ::nCol = 0
   endif  
   
return nil    
 

Incluimos esta modificación para el próximo build de FWH :-)

Re: Dos preguntas dos sobre la clase METRO

PostPosted: Mon May 06, 2024 3:58 am
by Armando
Master Antonio:

Muy agradecido.

Saludos