dialogos transparentes

Post Reply
Marcelo Via Giglio
Posts: 1033
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

dialogos transparentes

Post by Marcelo Via Giglio »

Holas,

si les interesa el tema de transparencia, pueden probrar
#include "fivewin.ch"
#include "Slider.ch"

FUNCTION main()

LOCAL oDlg, nTrans := 128, para

DEFINE DIALOG oDlg FROM 10,10 TO 20,40

@ 1,1 SLIDER nTrans OF oDlg;
HORIZONTAL ;
LEFT DIRECTION ;
RANGE 0, 255 ;
MARKS 25 ;
ON THUMBPOS ( setlayeredwindowattributes( oDlg:hWnd, 0, ntrans, 2 ), sysrefresh() );
ON CHANGE ( setlayeredwindowattributes( oDlg:hWnd, 0, ntrans, 2 ), sysrefresh() )

ACTIVATE DIALOG oDlg CENTER ON INIT ( para := getwindowlong( oDlg:hWnd, -20 ), ;
setwindowlong( oDlg:hWnd, -20, nOr( para, 524288 ) ) , ;
setlayeredwindowattributes( oDlg:hWnd, 0, ntrans, 2 ) )

RETURN(NIL)

DLL32 function getwindowlong( hwnd as LONG, index as LONG ) AS LONG PASCAL FROM "GetWindowLongA" lib "user32.dll"
DLL32 function setwindowlong( hwnd as LONG, index as LONG, newlog as LONG ) AS LONG PASCAL FROM "SetWindowLongA" lib "user32.dll"
DLL32 function setlayeredwindowattributes( hwnd as LONG, crkey as LONG, alpha as WORD, flag as LONG ) AS LONG PASCAL FROM "SetLayeredWindowAttributes" lib "user32.dll"
No pude hacer que la transparencia varie mientras cambia el slider, pero quien sabe alguien lo logre.

saludos

Marcelo
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

I'm founding some thing of it but I wish show a bitmap trasparent
If you go to mg sample you found a car bmp you can see only this car and not see the dialog...
Do U undestand ?
Best Regards, Saludos

Falconi Silvio
Rochinha
Posts: 309
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo
Contact:

Post by Rochinha »

See this sample:

Code: Select all

/*
 *
 * *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
 * Programador: Jose Carlos da Rocha
 * CopyRights.: 5Volution Desenvolvimento
 * *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
 *
 */
#include "fivewin.ch"

#define SRCPAINT       15597702
#define SRCAND         8913094

function main()
   DEFINE BRUSH oBrush STYLE NULL
   DEFINE DIALOG oWnd TITLE "Transparence" SIZE 800,600 BRUSH oBrush STYLE WS_POPUP
                                        
   ACTIVATE DIALOG oWnd CENTERED ;
               ON PAINT ShowBmp( oWnd, "transpr1.bmp", "transpr2.bmp" ) ;
               VALID iif(MsgYesNo('Deseja encerrar o programa?','Atencao'),.t.,.f.) 

function ShowBmp( oDlg, cBmp1, cBmp2 )
   local hDC  := oDlg:hDC
   local oBmp1, oBmp2
   DEFINE BITMAP oBmp1 FILENAME cBmp1
   DEFINE BITMAP oBmp2 FILENAME cBmp2
   DrawBitmap( hDC, oBmp2:hBitmap, 0, 0, 0, 0, SRCPAINT )
   DrawBitmap( hDC, oBmp1:hBitmap, 0, 0, 0, 0, SRCAND )
   oBmp1:End()
   oBmp2:End()
   return nil
And here, the bitmaps http://www.5volution.com/forum/transpr.zip
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

I saw it but I cannot move the dialog with the mouse
If you go to see the sample of minigui you can understand me
Best Regards, Saludos

Falconi Silvio
Rochinha
Posts: 309
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo
Contact:

Post by Rochinha »

Silvio

Can you send me?

irochinha@itelefonica.com.br
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

i sent now the prg
Best Regards, Saludos

Falconi Silvio
Rochinha
Posts: 309
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo
Contact:

Post by Rochinha »

Test this now:

Code: Select all

/*
 *
 * *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
 * Descricao..: Modulo de PDV
 * Programador: Jose Carlos da Rocha
 * CopyRights.: Konectiva Automacao
 * *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
 *
 */
#include "fivewin.ch"

#define SRCPAINT       15597702
#define SRCAND         8913094

function main()
   PUBLIC lNoPaint := .f.
   DEFINE BRUSH oBrush STYLE NULL
   DEFINE DIALOG oWnd TITLE "Transparence" SIZE 800,600 BRUSH oBrush STYLE WS_POPUP
                                        
   @ 0,0 BITMAP filename "" OF oWnd NOBORDER PIXEL SIZE 10,10 ON LEFT CLICK WindowMove()

   ACTIVATE DIALOG oWnd CENTERED ;
               ON PAINT ShowBmp( oWnd, "transpr1.bmp", "transpr2.bmp" ) ;
               VALID iif(MsgYesNo('Deseja encerrar o programa?','Atencao'),.t.,.f.) 

function ShowBmp( oDlg, cBmp1, cBmp2 )
   local hDC  := oDlg:hDC
   local oBmp1, oBmp2
   DEFINE BITMAP oBmp1 FILENAME cBmp1
   DEFINE BITMAP oBmp2 FILENAME cBmp2
   DrawBitmap( hDC, oBmp2:hBitmap, 0, 0, 0, 0, SRCPAINT )
   DrawBitmap( hDC, oBmp1:hBitmap, 0, 0, 0, 0, SRCAND )
   oBmp1:End()
   oBmp2:End()
   return nil

function WindowMove()
   Do while GetKeyState(VK_LBUTTON)
      onde:=GetCursorpos()
      MoveWindow( oWnd:hWnd, onde[1], onde[2], 20, 20, .t. )
      SysRefresh()
      If !GetKeyState(VK_LBUTTON)
         Exit
      Endif
   Enddo
   MoveWindow( oWnd:hWnd, onde[1], onde[2], 800, 600, .t. )
   Return nil
Post Reply