Transparentar UF

Hugo:
Quisiera saber el código para que el UF tenga fondo transparente; ésto es, que se vea la Hoja Excel de fondo...
Y, si no es mucho jorobarte, algo para quitar la barra de arriba del UF...
Un abrazo, y saludos!

1 respuesta

Respuesta
1
Coloca este codigo en Codigos de cualquier modulo
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Public Const GWL_STYLE As Long = -16&
Public Const WS_SYSMENU As Long = &H80000
Y este codigo en Codigos de un UserForm
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crey As Byte, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_ALPHA = &H2&
Public hWnd As Long
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
Dim bytOpacity As Byte
Dim lngWstyle As Long
bytOpacity = 200
hWnd = FindWindow("ThunderDFrame", Me.Caption)
Call SetWindowLong(Me.hWnd, GWL_EXSTYLE, GetWindowLong(Me.hWnd, GWL_EXSTYLE) Or WS_EX_LAYERED)
Call SetLayeredWindowAttributes(Me.hWnd, 0, bytOpacity, LWA_ALPHA)
hWnd = FindWindow(vbNullString, Me.Caption)
lngWstyle = GetWindowLong(hWnd, GWL_STYLE)
SetWindowLong hWnd, GWL_STYLE, lngWstyle And (Not WS_SYSMENU)
DrawMenuBar hWnd
End Sub
¡¡Espectacular, Master!! Ya voy preparando las 10 estrellas... Lo único... Para GRADUAR la opacidad, ¿modifico el bytOpacity? ¿En general, o sólo en el UF que quiera (¡¡quedó bárbaro!!)?
Estoy en línea, respondés y cierro. Un abrazo
Hugo: La cierro ahora, para liberar espacio. Espero la apostilla en mi próxima pregunta.
Reitero mi comentario: ¡¡Espectacular!!
Un abrazo

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas