Test Foro de elhacker.net SMF 2.1

Programación => .NET (C#, VB.NET, ASP) => Programación General => Programación Visual Basic => Mensaje iniciado por: CH4ØZ en 3 Octubre 2009, 08:28 AM

Título: duda de los form
Publicado por: CH4ØZ en 3 Octubre 2009, 08:28 AM
hay alguna manera de hacer el form transparente, pero que a la vez se vea su contenido ???
Título: Re: duda de los form
Publicado por: BlackZeroX en 3 Octubre 2009, 08:45 AM
Contenido, cual? de que forma?

bueno en dado caso aqui tienes para hacerlo transparente:

Antes que nada disculpa el ponertelo asi, la razon es por que de igual forma puedes usar la funcion Transparencia para hacer otras cosas transparentes ademàs del form!¡.
Código (vb) [Seleccionar]

Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crey As Byte, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
Const LWA_ALPHA = &H2&

Public Function Transparencia(Handle As Long, Level As Byte) As Long
   Dim Estilo As Long
   Estilo = GetWindowLong(Handle, GWL_EXSTYLE)
   Call SetWindowLong(Handle, _
                      GWL_EXSTYLE, _
                      Estilo Or WS_EX_LAYERED)
   Call SetLayeredWindowAttributes(Handle, 0, Level, LWA_ALPHA)
   Transparencia = 1
   Exit Function
errs:
   Transparencia = 0
End Function

Public Function Transparencia_Form(ByVal hwnd As Long, valor As Integer) As Long
   On Local Error GoTo errs
   If valor < 0 Or valor > 255 Then
       Transparencia_Form = 1
   Else
       SetWindowLong hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED
       Call Transparencia(hwnd, CByte(valor))
       Transparencia_Form = 0
   End If
   Transparencia_Form = 1
   Exit Function
errs:
   Transparencia_Form = 0
   err.clear
End Function


Para hacer Regiones del form transparente es de otra forma, creo que ya esta posteada esa forma desde hace tiempo en el foro!¡.

Dulces Lunas!¡.
Título: Re: duda de los form
Publicado por: CH4ØZ en 3 Octubre 2009, 09:06 AM
gracias x la respuesta
el contenido serian 2 shapes
y adentro de los shapes hay otras cosas
labels picturebox image etc
Título: Re: duda de los form
Publicado por: CH4ØZ en 3 Octubre 2009, 09:53 AM
yo necesitaria que los objetos dentro del form no se transparenten con el mismo, como puedo hacerlo???
Título: Re: duda de los form
Publicado por: Dessa en 3 Octubre 2009, 12:58 PM
Hola, probá si este code te sirve

http://foro.elhacker.net/programacion_vb/como_hacer_esto_medio_transparente-t256170.0.html;msg1242108#msg1242108  (http://foro.elhacker.net/programacion_vb/como_hacer_esto_medio_transparente-t256170.0.html;msg1242108#msg1242108)


S2