Dialog Transparent

nixbeau
Posts: 28
Joined: Sun Jan 08, 2012 6:17 pm

Dialog Transparent

Post by nixbeau »

amigos, quería poner un cuadro de diálogo acerca de otro diálogo para mantenerse en la cima era transparente y podía ver el contenido desde atrás. ¿Puede alguien darme un ejemplo?

Utilizar:

Code: Select all

DEFINE DIALOG frmPDV RESORCE 'TELAPDV' TRANSPARENT
. No trabaja.
Utilizar:

Code: Select all

DEFINE DIALOG frmPDV RESORCE 'TELAPDV'; frmPDV:lTrasparent:=.t.
. No trabaja.

Yo uso la opción PellesC transparente y además no funciona.
User avatar
Antonio Linares
Site Admin
Posts: 37485
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Dialog Transparent

Post by Antonio Linares »

Puedes hacerlo asi:

ACTIVATE DIALOG oDlg ON INIT SetTrans( oDlg )

...

Code: Select all

function SetTrans( oDlg ) 

   SetWindowLong( oDlg:hWnd, GWL_EXSTYLE, nOr( GetWindowLong( oDlg:hWnd, GWL_EXSTYLE ), WS_EX_LAYERED ) ) 

   SetLayeredWindowAttributes( oDlg:hWnd,,, LWA_COLORKEY ) 

return nil
regards, saludos

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

Re: Dialog Transparent

Post by Antonio Linares »

Habia un ejemplo en el que podiamos establecer el nivel de transparencia de un diálogo, pero no lo localizo.

Alguien recuerda cual era ? gracias :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Dialog Transparent

Post by anserkk »

Code: Select all

oDlg:nOpacity  := 180
nixbeau
Posts: 28
Joined: Sun Jan 08, 2012 6:17 pm

Re: Dialog Transparent

Post by nixbeau »

Antonio Linares wrote:Puedes hacerlo asi:

ACTIVATE DIALOG oDlg ON INIT SetTrans( oDlg )

...

Code: Select all

function SetTrans( oDlg ) 

   SetWindowLong( oDlg:hWnd, GWL_EXSTYLE, nOr( GetWindowLong( oDlg:hWnd, GWL_EXSTYLE ), WS_EX_LAYERED ) ) 

   SetLayeredWindowAttributes( oDlg:hWnd,,, LWA_COLORKEY ) 

return nil

Eso no sería VB?
Dado que el uso BRUSH oBRUSH TRANSPARENT funciona?
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Dialog Transparent

Post by FranciscoA »

Hola, Encontré este codigo por ahi. Nunca lo probé.

Code: Select all

#include "FiveWin.ch"

Function Main()
local oGet, cSeguridad:=Space(12), ide:=Space(10)
local oBrush, para


Define Brush oBrush COLOR nRGB( 255, 106, 0 )
Define Dialog oDlgC ResName "demo"  Brush oBrush TRANSPARENT

  ReDefine Get oGet var ide        id 101 of oDlgC
  ReDefine Get oGet var cSeguridad id 102 of oDlgC

  ReDefine Button id 201 of oDlgC
  
  ReDefine Button id 202 of oDlgC;
  Action (oDlgC:End())
    
oDlgC:lHelpIcon:=.f.
Activate Dialog oDlgC Center;
On Init( Dialogo:= getwindowlong( oDlgC:hWnd, -20 ), ;
setwindowlong( oDlgC:hWnd, -20, nOr( Dialogo, 524288 ) ) , ;
setlayeredwindowattributes( oDlgC:hWnd, 0, 230, 2 ) )    // El parametro 230 
oBrush:End()                                             // es el nivel de transparencia 
Return Nil                                               // el el tope maximo es 255 entre
                                                                            // Menor seal este numero mas trasnparente sera 

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" 
 
Saludos.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
User avatar
Antonio Linares
Site Admin
Posts: 37485
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Dialog Transparent

Post by Antonio Linares »

Nixbeau,

Como ha comentado Anserkk, esta es la forma correcta para establecer un cierto nivel de transparencia:

Code: Select all

#include "FiveWin.ch"

function Main()

   local oDlg

   DEFINE DIALOG oDlg

   oDlg:nOpacity = 100

   ACTIVATE DIALOG oDlg CENTERED

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
horacio
Posts: 1270
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: Dialog Transparent

Post by horacio »

nixbeau
Posts: 28
Joined: Sun Jan 08, 2012 6:17 pm

Re: Dialog Transparent

Post by nixbeau »

Antonio Linares wrote:Nixbeau,

Como ha comentado Anserkk, esta es la forma correcta para establecer un cierto nivel de transparencia:

Code: Select all

#include "FiveWin.ch"

function Main()

   local oDlg

   DEFINE DIALOG oDlg

   oDlg:nOpacity = 100

   ACTIVATE DIALOG oDlg CENTERED

return nil

He utilizado el comando brillaba y parecía poner todo el formulario, incluyendo gets y says y memos.

He utilizado el comando: frmPDV: nOpacity = 100. ¿Cómo puedo obtener sólo el frmPDV (DIALOG) es transparente?

Dialog sólo necesita ser transparente, sin ningún otro componente.

Image
User avatar
Antonio Linares
Site Admin
Posts: 37485
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Dialog Transparent

Post by Antonio Linares »

Te refieres a que solo quieres que el fondo sea transparente ?

Puedes mostrar un dibujo de como quieres que se vea ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
nixbeau
Posts: 28
Joined: Sun Jan 08, 2012 6:17 pm

Re: Dialog Transparent

Post by nixbeau »

Antonio Linares wrote:Te refieres a que solo quieres que el fondo sea transparente ?

Puedes mostrar un dibujo de como quieres que se vea ?

Hola Antonio, gracias por la ayuda.
Siga la imagen de como me gusta el trabajo form1.
De hecho, esta imagen representa mi necesidad, pero el uso de la relación trasnparencia pantalla se pone en la pantalla que cubre algunas partes y dejando otro visible. No necesariamente el desktop.

Image
User avatar
Antonio Linares
Site Admin
Posts: 37485
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Dialog Transparent

Post by Antonio Linares »

Prueba a usar un Brush NULL:

DEFINE BRUSH oBrush STYLE NULL

DEFINE DIALOG oDlg BRUSH oBrush ...

...
regards, saludos

Antonio Linares
www.fivetechsoft.com
nixbeau
Posts: 28
Joined: Sun Jan 08, 2012 6:17 pm

Re: Dialog Transparent

Post by nixbeau »

Antonio Linares wrote:Prueba a usar un Brush NULL:

DEFINE BRUSH oBrush STYLE NULL

DEFINE DIALOG oDlg BRUSH oBrush ...

...

Image
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Dialog Transparent

Post by nageswaragunupudi »

Code: Select all

DEFINE DIALOG oDlg COLOR CLR_BLACK,RGB(1,1,1)
<...... place all controls ....>
oDlg:nSeeThroClr := RGB(1,1,1)
ACTIVATE DIALOG oDlg
 
Regards

G. N. Rao.
Hyderabad, India
nixbeau
Posts: 28
Joined: Sun Jan 08, 2012 6:17 pm

Re: Dialog Transparent

Post by nixbeau »

nageswaragunupudi wrote:

Code: Select all

DEFINE DIALOG oDlg COLOR CLR_BLACK,RGB(1,1,1)
<...... place all controls ....>
oDlg:nSeeThroClr := RGB(1,1,1)
ACTIVATE DIALOG oDlg
 
Perfecto nageswaragunupudi, muy bueno. Funcionó a la perfección.
¿Podría explicar el funcionamiento del mando? Me gustaría entender por qué lo hace.
Post Reply