RIBBON con imagenes PNG (SOLUCIONADO)

RIBBON con imagenes PNG (SOLUCIONADO)

Postby Patricio Avalos Aguirre » 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
Last edited by Patricio Avalos Aguirre on Fri Apr 26, 2013 2:51 pm, edited 1 time in total.
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
User avatar
Patricio Avalos Aguirre
 
Posts: 1059
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile

Re: RIBBON con imagenes PNG

Postby cnavarro » Fri Apr 26, 2013 1:02 pm

Buenas tardes
En la asignacion de la imagen puedes utilizar una funcion como la siguiente:

Code: Select all  Expand view


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
User avatar
cnavarro
 
Posts: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: RIBBON con imagenes PNG

Postby Patricio Avalos Aguirre » Fri Apr 26, 2013 2:50 pm

Hola cNavarro

muchas gracias por tu respuesta

modifique la clase y funciona muy bien

aqui dejo la modificacion

Code: Select all  Expand view
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
User avatar
Patricio Avalos Aguirre
 
Posts: 1059
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile

Re: RIBBON con imagenes PNG (SOLUCIONADO)

Postby DARWIN UZCATEGUI » Sat Apr 27, 2013 7: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
User avatar
DARWIN UZCATEGUI
 
Posts: 5
Joined: Tue Apr 09, 2013 7:37 pm
Location: Catia la Mar Edo Vargas - Venezuela

Re: RIBBON con imagenes PNG (SOLUCIONADO)

Postby DARWIN UZCATEGUI » Sat Apr 27, 2013 7:48 am

Con la linea.

Image

Uploaded with ImageShack.us

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

Uploaded with ImageShack.us
User avatar
DARWIN UZCATEGUI
 
Posts: 5
Joined: Tue Apr 09, 2013 7:37 pm
Location: Catia la Mar Edo Vargas - Venezuela

Re: RIBBON con imagenes PNG (SOLUCIONADO)

Postby Patricio Avalos Aguirre » Sat Apr 27, 2013 1: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
User avatar
Patricio Avalos Aguirre
 
Posts: 1059
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile

Re: RIBBON con imagenes PNG (SOLUCIONADO)

Postby Antonio Linares » Sat Apr 27, 2013 1:40 pm

Muy buena mejora, gracias a todos! :-)
regards, saludos

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

Re: RIBBON con imagenes PNG (SOLUCIONADO)

Postby joseluisysturiz » Sat Apr 27, 2013 3: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!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 34 guests