05. august 2003 - 10:39
Der er
2 kommentarer og
1 løsning
hvordan laver jeg en tranparant form!?
jeg har mange steder fundet former der er helt usynelige, men hvordan for jeg den til kun at være gennemsigtig!?
05. august 2003 - 12:03
#1
Du skal lige være OBS på at det ikke virker på Win9x/ME
Option Explicit
'---------------------------------- Form1 eller Module1 ----------------------------------
Private Const LWA_COLORKEY = &H1
Private Const LWA_ALPHA = &H2
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
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 crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Public Sub WindowLayer(frm As Form, ByVal lngValue As Long)
Dim lngRet As Long
lngRet = GetWindowLong(frm.hWnd, GWL_EXSTYLE)
lngRet = lngRet Or WS_EX_LAYERED
SetWindowLong Me.hWnd, GWL_EXSTYLE, lngRet
SetLayeredWindowAttributes frm.hWnd, 0, lngValue, LWA_ALPHA
End Sub
'---------------------------------- Form1 eller Module1 ----------------------------------
'---------------------------------------- Form1 ------------------------------------------
Private Sub Form_Load()
With HScroll1
.Max = 255
.Min = 0
.LargeChange = 50
.SmallChange = 1
.value = 192
Call WindowLayer(Me, .value)
End With
End Sub
Private Sub HScroll1_Change()
Call WindowLayer(Me, HScroll1.value)
End Sub
Private Sub HScroll1_Scroll()
Call WindowLayer(Me, HScroll1.value)
End Sub
'---------------------------------------- Form1 ------------------------------------------