FoxPro/Visual FoxPro - pantalla

   
Vista:

pantalla

Publicado por wenceslao piraquive (134 intervenciones) el 22/07/2008 21:52:30
hola amigos, existe la posibilidad de dejar el formulario principal, donde va el menu de mi aplicacion transparente??

lo digo porque he visto unos programas que tienen una presentacion transparente y lo que muestra de fondo es el escritorio del computador donde esta instalado.

si me pueden ayudar muchas gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:pantalla

Publicado por sergio (697 intervenciones) el 23/07/2008 17:06:31
Copia esto en un prg y ejecutalo y toma esto como un ejemplo para ver como funciona

oForm = CREATEOBJECT("Tform")
oForm.Visible = .T.
READ EVENTS

DEFINE CLASS tform As Form
#DEFINE LWA_COLORKEY 1
#DEFINE LWA_ALPHA 2
#DEFINE GWL_EXSTYLE -20
#DEFINE WS_EX_LAYERED 0x80000
Autocenter=.T.
Caption="Formulario Transparente"
ShowWindow=2
TransparentModeSet=.F.
hwnd=0

ADD OBJECT cmdSet As CommandButton WITH;
Left=10, Top=10, Height=27, Width=80, Caption="Set"

ADD OBJECT cmdClear As CommandButton WITH;
Left=100, Top=10, Height=27, Width=80, Caption="Clear"

ADD OBJECT chRgb As CheckBox WITH;
Left=10, Top=50, Autosize=.T., BackStyle=0,;
Caption="ColorRef", Value=.F.

ADD OBJECT lblRgb As Label WITH;
Left=100, Top=50, Autosize=.T., Caption="Rgb:"

ADD OBJECT txtRgb As TextBox WITH;
Left=140, Top=48, Width=80, Height=24, Value=RGB(192,192,192)

ADD OBJECT cmdRgb As CommandButton WITH;
Left=220, Top=48, Width=24, Height=24, Caption="..."

ADD OBJECT chAlpha As CheckBox WITH;
Left=10, Top=80, Autosize=.T., BackStyle=0,;
Caption="Alpha", Value=.T.

ADD OBJECT lblAlpha As Label WITH;
Left=100, Top=80, Autosize=.T., Caption="Value:"

ADD OBJECT txtAlpha As Spinner WITH;
Left=140, Top=78, Width=80, Height=24, Value=128,;
SpinnerLowValue=0, SpinnerHighValue=255,;
KeyboardLowValue=0, KeyboardHighValue=255

PROCEDURE Init
DECLARE INTEGER GetWindowLong IN user32;
INTEGER hWnd, INTEGER nIndex

DECLARE INTEGER SetWindowLong IN user32;
INTEGER hWnd, INTEGER nIndex, INTEGER dwNewLong

DECLARE INTEGER SetLayeredWindowAttributes IN user32;
INTEGER hwnd, INTEGER crKey,;
SHORT bAlpha, INTEGER dwFlags

THIS.txtRgb.Value = THIS.BackColor

IF INT(VERSION(5)/100)<7
This.RetHandle()
ENDIF

PROCEDURE Destroy
CLEAR EVENTS

PROCEDURE SetTransparentMode
LOCAL nExStyle, nRgb, nAlpha, nFlags
nExStyle = GetWindowLong(THIS.HWnd, GWL_EXSTYLE)
nExStyle = BITOR(nExStyle, WS_EX_LAYERED)
= SetWindowLong(THIS.HWnd, GWL_EXSTYLE, nExStyle)
*!* IF NOT THIS.chRgb.Value AND NOT THIS.chAlpha.Value
*!* THIS.chAlpha.Value=.T.
*!* ENDIF
nRgb = RGB(192,192,192) &&IIF(THIS.chRgb.Value, THIS.txtRgb.Value, 0)
nAlpha = 128 &&IIF(THIS.chAlpha.Value, THIS.txtAlpha.Value, 0)
nFlags = 0 + LWA_ALPHA &&IIF(THIS.chRgb.Value, LWA_COLORKEY, 0) + IIF(THIS.chAlpha.Value, LWA_ALPHA, 0)

= SetLayeredWindowAttributes(THIS.HWnd, m.nRgb,m.nAlpha, m.nFlags)

PROCEDURE ClearTransparentMode
LOCAL nExStyle
nExStyle = GetWindowLong(THIS.HWnd, GWL_EXSTYLE)
nExStyle = BITXOR(nExStyle, WS_EX_LAYERED)
= SetWindowLong(THIS.HWnd, GWL_EXSTYLE, nExStyle)

PROCEDURE cmdSet.Click
ThisForm.SetTransparentMode
ThisForm.TransparentModeSet=.T.

PROCEDURE cmdClear.Click
ThisForm.ClearTransparentMode
ThisForm.TransparentModeSet=.F.

PROCEDURE chRgb.Click
IF ThisForm.TransparentModeSet
ThisForm.SetTransparentMode
ENDIF

PROCEDURE txtRgb.When
RETURN .F.

PROCEDURE cmdRgb.Click
LOCAL nRgb
nRgb = GETCOLOR()
IF nRgb <> -1
ThisForm.txtRgb.Value = nRgb
IF ThisForm.TransparentModeSet AND ThisForm.chRgb.Value
ThisForm.SetTransparentMode
ENDIF
ENDIF

PROCEDURE chAlpha.Click
IF ThisForm.TransparentModeSet
ThisForm.SetTransparentMode
ENDIF

PROCEDURE txtAlpha.InteractiveChange
IF ThisForm.TransparentModeSet AND ThisForm.chAlpha.Value
ThisForm.SetTransparentMode
ENDIF

Procedure RetHandle
DECLARE INTEGER FindWindow IN WIN32API ;
STRING cClassName, ;
STRING cWindName
THISFORM.hwnd = FindWindow(0,This.CAPTION)
ENDPROC

ENDDEFINE
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar