dialogos transparentes

dialogos transparentes

Postby Marcelo Via Giglio » Mon Mar 03, 2008 9:11 pm

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
Marcelo Via Giglio
 
Posts: 1069
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Postby Silvio » Mon Mar 03, 2008 11:04 pm

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
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Rochinha » Tue Mar 04, 2008 2:25 am

See this sample:

Code: Select all  Expand view  RUN
/*
*
* *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
* 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
Rochinha
 
Posts: 310
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo

Postby Silvio » Tue Mar 04, 2008 10:04 am

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
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Rochinha » Tue Mar 04, 2008 1:58 pm

Silvio

Can you send me?

irochinha@itelefonica.com.br
Rochinha
 
Posts: 310
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo

Postby Silvio » Tue Mar 04, 2008 4:04 pm

i sent now the prg
Best Regards, Saludos

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

Postby Rochinha » Tue Mar 04, 2008 11:17 pm

Test this now:

Code: Select all  Expand view  RUN
/*
*
* *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
* 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
Rochinha
 
Posts: 310
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 50 guests