FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour RIBBON con imagenes PNG (SOLUCIONADO)
Posts: 1074
Joined: Fri Oct 07, 2005 01:56 PM
RIBBON con imagenes PNG (SOLUCIONADO)
Posted: Fri Apr 26, 2013 12:38 PM

Estimados

Es posible que los botones de RIBON pueda usar imagen PNG
ya que son mas vistosos actualmente los paso a bmp

Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: RIBBON con imagenes PNG
Posted: Fri Apr 26, 2013 01:02 PM
Buenas tardes
En la asignacion de la imagen puedes utilizar una funcion como la siguiente:

Code (fw): Select all Collapse
Function CargaImgBtt( cFile , oButton )
Local  lSw    := .F.
Local  cExt   := ""
if !empty( cFile )
   cExt          :=  Right( Upper( cFile ), 3 )
   if cExt  =  "BMP"
      if !empty( oButton )
         //? cFile
         oButton:LoadBitmaps( cFile )
         lSw    := .T.
      endif
   else
      if !empty( oButton )
         oButton:hBitmap1 := FWOpenPngFile( cFile )
         lSw    := .T.
      endif
   endif
   if lSw
      oButton:HasAlpha( oButton:hBitmap1, BTN_UP )
      oButton:Refresh()
   endif
endif
Return lSw


No recuerdo donde la vi, pero yo la uso para cualquier tipo de button
Un saludo
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 1074
Joined: Fri Oct 07, 2005 01:56 PM
Re: RIBBON con imagenes PNG
Posted: Fri Apr 26, 2013 02:50 PM
Hola cNavarro

muchas gracias por tu respuesta

modifique la clase y funciona muy bien

aqui dejo la modificacion

Code (fw): Select all Collapse
METHOD LoadBitmaps( cName ) CLASS TRBtn

   local aBmpPal

   if ! Empty( cName )

      if ! File( cName )
         aBmpPal = PalBmpLoad( cName )
         ::hBitmap1  = aBmpPal[ 1 ]
         ::hPalette1 = aBmpPal[ 2 ]
         ::HasAlpha( ::hBitmap1 )
      else
         ::cName = cName
            if upper(right(cName,3))="PNG"
                ::hBitmap1  = FWOpenPngFile( cName )
                ::hPalette1 = 0
                ::HasAlpha( ::hBitmap1 )
            else
               aBmpPal     = PalBmpRead( ::GetDC(), cName )
               ::hBitmap1  = aBmpPal[ 1 ]
               ::hPalette1 = aBmpPal[ 2 ]
               ::ReleaseDC()
            endif
      endif
   endif

   if ! Empty( ::hBitmap1 )
      PalBmpNew( ::hWnd, ::hBitmap1, ::hPalette1 )
   endif

return nil
Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
Posts: 5
Joined: Tue Apr 09, 2013 07:37 PM
Re: RIBBON con imagenes PNG (SOLUCIONADO)
Posted: Sat Apr 27, 2013 07:33 AM
Saludos falta colocar una linea
aquí anexo la clase con la linea modificada
// en else de bmp ::HasAlpha( ::hBitmap1 ) // falta esta lineas

METHOD LoadBitmaps( cName ) CLASS TRBtn

local aBmpPal

if ! Empty( cName )


if ! File( cName )
aBmpPal = PalBmpLoad( cName )
::hBitmap1 = aBmpPal[ 1 ]
::hPalette1 = aBmpPal[ 2 ]
::HasAlpha( ::hBitmap1 )
else
::cName = cName
if upper(right(cName,3))="PNG"
::hBitmap1 = FWOpenPngFile( cName )
::hPalette1 = 0
::HasAlpha( ::hBitmap1 )
else
aBmpPal = PalBmpRead( ::GetDC(), cName )
::hBitmap1 = aBmpPal[ 1 ]
::hPalette1 = aBmpPal[ 2 ]
::HasAlpha( ::hBitmap1 ) // falta esta lineas
::ReleaseDC()
endif
endif
endif


if ! Empty( ::hBitmap1 )
PalBmpNew( ::hWnd, ::hBitmap1, ::hPalette1 )
endif

return nil
Posts: 5
Joined: Tue Apr 09, 2013 07:37 PM
Re: RIBBON con imagenes PNG (SOLUCIONADO)
Posted: Sat Apr 27, 2013 07:48 AM
Con la linea.



Uploaded with ImageShack.us

sin la instrucción .. la imagen se altera (bmp)


Uploaded with ImageShack.us
Posts: 1074
Joined: Fri Oct 07, 2005 01:56 PM
Re: RIBBON con imagenes PNG (SOLUCIONADO)
Posted: Sat Apr 27, 2013 01:23 PM

Hola Darwin

correcta la observacion

gracias..!!

Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: RIBBON con imagenes PNG (SOLUCIONADO)
Posted: Sat Apr 27, 2013 01:40 PM

Muy buena mejora, gracias a todos! :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2064
Joined: Fri Jan 06, 2006 09:28 PM
Re: RIBBON con imagenes PNG (SOLUCIONADO)
Posted: Sat Apr 27, 2013 03:11 PM

Que buen aporte y cambio, tambien funciona si la imagen esta en recurso.? gracias, saludos... :shock:

Dios no está muerto...



Gracias a mi Dios ante todo!

Continue the discussion