Page 1 of 2
Dialog Transparent
Posted: Mon Mar 18, 2013 8:57 pm
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.
Re: Dialog Transparent
Posted: Mon Mar 18, 2013 10:38 pm
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
Re: Dialog Transparent
Posted: Mon Mar 18, 2013 10:51 pm
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

Re: Dialog Transparent
Posted: Tue Mar 19, 2013 10:37 am
by anserkk
Re: Dialog Transparent
Posted: Tue Mar 19, 2013 11:14 am
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?
Re: Dialog Transparent
Posted: Wed Mar 20, 2013 12:37 am
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.
Re: Dialog Transparent
Posted: Wed Mar 20, 2013 8:45 am
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
Re: Dialog Transparent
Posted: Wed Mar 20, 2013 1:14 pm
by horacio
Re: Dialog Transparent
Posted: Wed Mar 20, 2013 9:28 pm
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.

Re: Dialog Transparent
Posted: Thu Mar 21, 2013 10:02 am
by Antonio Linares
Te refieres a que solo quieres que el fondo sea transparente ?
Puedes mostrar un dibujo de como quieres que se vea ?
Re: Dialog Transparent
Posted: Fri Mar 22, 2013 12:01 pm
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.

Re: Dialog Transparent
Posted: Fri Mar 22, 2013 12:06 pm
by Antonio Linares
Prueba a usar un Brush NULL:
DEFINE BRUSH oBrush STYLE NULL
DEFINE DIALOG oDlg BRUSH oBrush ...
...
Re: Dialog Transparent
Posted: Fri Mar 22, 2013 12:48 pm
by nixbeau
Antonio Linares wrote:Prueba a usar un Brush NULL:
DEFINE BRUSH oBrush STYLE NULL
DEFINE DIALOG oDlg BRUSH oBrush ...
...

Re: Dialog Transparent
Posted: Fri Mar 22, 2013 9:26 pm
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
Re: Dialog Transparent
Posted: Fri Mar 22, 2013 9:42 pm
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.