Transparencia de un bitmap en una ventana (Solucionado)

Transparencia de un bitmap en una ventana (Solucionado)

Postby groiss » Tue Jan 23, 2018 10:13 am

Creo una ventana, y en ella pongo dos bitmas de esta forma:
Code: Select all  Expand view

SetSkinButtonsColors( 1, { { 0.33, nRGB( 167,  73, 169 ), nRGB( 253, 157, 165 ) }, ;
                              { 0.33, nRGB( 253, 157, 165 ), nRGB( 167,  73, 169 ) } },;
                         nRGB( 153, 43, 153 ), nRGB( 213, 102, 213 ) )

SkinButtons()
SetDlgGradient( { { 1, nRGB( 201, 217, 237 ), nRGB( 231, 242, 255 ) } } )

DEFINE BRUSH oBrush STYLE NULL
DEFINE ICON  oIcon  resname "ico"
DEFINE CURSOR ocurdedo RESNAME "curdedo"
DEFINE FONT supFont NAME "MS SANS SERIF" size 0, -10
DEFINE WINDOW oWnd FROM 1, 5 TO 20, 65  ;
   BRUSH oBrush                      ;
   TITLE "Gestión de Camping Ver.:3.1801.23";
   ICON  oIcon                       ;
   MENU  BuildMenu()
   oWnd:ofont:=supfont
define bitmap obmp RESOURCE "prueba"

ACTIVATE WINDOW oWnd MAXIMIZED  valid(final());
  ON PAINT {gradpaint( hDC, ownd ), Drawmasked( hDC,obmp:hBitmap, ownd:nbottom-400, ownd:nright-510)}

 

Mi pregunta es la siguiente, ¿hay alguna forma de asignar un tooltip al bitmap?, y¿ de ejecutar una acción al hacer click sobre el mismo?
El problema radica en que si defino el bitmap de la forma @x, y bitmap ... si puedo ejecutar las acciones asociadas al mismo, pero no puedo ponerlo transparente sobre la ventana, su fondo real en blanco, y si lo pongo transparente se me muestra el fondo negro, si modifico el brush de la ventana al transparentarlo pasa a verse evidentemente como el fondo de la ventana, pero no con el degradaado que le he puesto a la ventana .
Muchas gracias.
Un saludo
Last edited by groiss on Wed Jan 24, 2018 6:37 am, edited 1 time in total.
groiss
 
Posts: 217
Joined: Tue Sep 01, 2009 7:55 am
Location: Plasencia - ESPAÑA

Re: Consulta sobre bitmap

Postby karinha » Tue Jan 23, 2018 11:31 am

Intenta asi:


Code: Select all  Expand view

   DEFINE BITMAP oBmp RESOURCE "PRUEBA" OF oWnd ADJUST TRANSPARENT ;
       ON CLICK( ACTION_BITMAP() )

   oBmp:cToolTip := "Hay ToolTip"
 


Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7154
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Consulta sobre bitmap

Postby groiss » Tue Jan 23, 2018 12:24 pm

karinha wrote:Intenta asi:


Code: Select all  Expand view

   DEFINE BITMAP oBmp RESOURCE "PRUEBA" OF oWnd ADJUST TRANSPARENT ;
       ON CLICK( ACTION_BITMAP() )

   oBmp:cToolTip := "Hay ToolTip"
 


Saludos.

Joao muchas gracias, pero no me lo admite me da un error en el preprocesado la clausula on click no la acepta.
Un saludo
groiss
 
Posts: 217
Joined: Tue Sep 01, 2009 7:55 am
Location: Plasencia - ESPAÑA

Re: Consulta sobre bitmap

Postby karinha » Tue Jan 23, 2018 1:09 pm

Image

Code: Select all  Expand view

#include "Fivewin.ch"

PROCEDURE MAIN()

   Local oFont, oWnd, oBar, b1, b2, b3, b4, b5
   local oBtn, cVer := FWVERSION

   SetBalloon( .T. ) // Balloon shape required for tooltips
   SkinButtons()

   DEFINE FONT oFont NAME "MS Sans Serif" SIZE 0,-10

   DEFINE WINDOW oWnd FROM 0,0 TO 474,639 PIXEL TITLE "Test BTNBMP"

   oWnd:SetFont(oFont)

   DEFINE BUTTONBAR oBar TOP _3D SIZE 50,50 OF oWnd

   @ 100, 165 BTNBMP oBtn OF oWnd  ;
       SIZE 120, 120 ;
       PROMPT cVer + CRLF + "FiveWin" FILE "..\BITMAPS\sms.bmp" 2007 ;
       FONT oFont RIGHT ;
       ACTION MsgInfo("Hello")  ;
       TOOLTIP( "Hay tooltip beatiful" ) // funciona mui bien

   oBtn:lEllipse = .T.

   // oBtn:cToolTip := "Hay Tooltip beatiful" // funciona tambien

   DEFINE MSGBAR OF oWnd PROMPT "Testing bitmaped buttons with captions" ;
      TIME DATE NOINSET

   ACTIVATE WINDOW oWnd

RETURN NIL
 


Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7154
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Consulta sobre bitmap

Postby nageswaragunupudi » Tue Jan 23, 2018 2:14 pm

Mi pregunta es la siguiente, ¿hay alguna forma de asignar un tooltip al bitmap?, y¿ de ejecutar una acción al hacer click sobre el mismo?
El problema radica en que si defino el bitmap de la forma @x, y bitmap ... si puedo ejecutar las acciones asociadas al mismo, pero no puedo ponerlo transparente sobre la ventana, su fondo real en blanco, y si lo pongo transparente se me muestra el fondo negro, si modifico el brush de la ventana al transparentarlo pasa a verse evidentemente como el fondo de la ventana, pero no con el degradaado que le he puesto a la ventana .
Muchas gracias.


Please try:
Code: Select all  Expand view
#include "fivewin.ch"

//----------------------------------------------------------------------------//

function Main()

   local oWnd, oBrush, oBmp

   DEFINE BRUSH oBrush GRADIENT { { 1, CLR_BLUE, CLR_WHITE } }
   DEFINE WINDOW oWnd BRUSH oBrush

   @ 60,150 BITMAP oBmp FILE "c:\fwh\bitmaps\alphabmp\calendar.bmp" ;
      SIZE 132,132 PIXEL OF oWnd ;
      NOBORDER ;
      ON CLICK MsgInfo( "Action" )
   oBmp:cToolTip  := "This is a tooltip"

   ACTIVATE WINDOW oWnd CENTERED
   RELEASE BRUSH oBrush

return nil

//----------------------------------------------------------------------------//
 


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10207
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Consulta sobre bitmap

Postby nageswaragunupudi » Tue Jan 23, 2018 4:47 pm

We can get the same effect using BTNBMP with TRANSPARENT clause.
Code: Select all  Expand view
#include "fivewin.ch"

function BtnTransp()

   local oWnd, oBrush, oBtn

   DEFINE BRUSH oBrush GRADIENT { { 1, CLR_GREEN, CLR_WHITE } } HORIZONTAL
   DEFINE WINDOW oWnd BRUSH oBrush

   @ 60,150 BTNBMP oBtn FILE "c:\fwh\bitmaps\pngs\2.png" ;
      SIZE 128,128 PIXEL OF oWnd FLAT ;
      ACTION MsgInfo( "Action" ) ;
      TOOLTIP "This is a tooltip" ;
      NOBORDER TRANSPARENT

   ACTIVATE WINDOW oWnd CENTERED
   RELEASE BRUSH oBrush

return nil
 


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10207
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Consulta sobre bitmap

Postby groiss » Wed Jan 24, 2018 6:34 am

Muchas gracias a ambos, al final lo resolví de esta forma:
Code: Select all  Expand view

@ 50,100 bitmap ocheckout resource "MIBITMAP" size 259,259 pixel noborder of ownd on click checkout()
ocheckout:ctooltip:="Mi tooltip está aquí"
ocheckout:ltransparent:=.t.
 


Pero el error gordo que tenía era generar un fondo degradado sobre un brush nulo, lo que provocaba que la transparencia se hiciese al negro, así que en cuanto modifiqué el brush, quedándolo así:
Code: Select all  Expand view

DEFINE BRUSH oBrush GRADIENT { { 1, nRGB( 201, 217, 237 ), nRGB( 231, 242, 255 ) } }
 


Todo comenzó a funcionar.
Nuevamente gracias.
Un saludo
groiss
 
Posts: 217
Joined: Tue Sep 01, 2009 7:55 am
Location: Plasencia - ESPAÑA


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 12 guests