Kirjautuminen

Haku

Tehtävät

Keskustelu: Koodit: VB6: Läpinäkyvä formi

Bill Keltanen [11.04.2004 09:07:05]

#

Tää laittaa formin sisustan läpinäkyväksi. Lisäät UserControl1 ja Form1. UserControlliin Timer1 ja Form1 sitten se UserControl

Form1

Private Sub Form_Load()
Form1.BackColor = &HFF0000
End Sub

UserControl1

Option Explicit
Const LW_KEY = &H1
Const G_E = (-20)
Const W_E = &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 ReleaseCapture Lib "user32.dll" () As Long
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32.dll" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Sub Timer1_Timer()
On Error Resume Next
Dim Ret As Long
Dim TC As Long
TC = vbBlue
Ret = GetWindowLong(UserControl.Parent.hWnd, G_E)
Ret = Ret Or W_E
SetWindowLong UserControl.Parent.hWnd, G_E, Ret
SetLayeredWindowAttributes UserControl.Parent.hWnd, TC, 0, LW_KEY
UserControl.BackColor = UserControl.Parent.BackColor
End Sub

Private Sub UserControl_Initialize()
Timer1.Interval = 5000
On Error Resume Next
UserControl.BackColor = UserControl.Parent.BackColor
End Sub

Vastaus

Aihe on jo aika vanha, joten et voi enää vastata siihen.

Tietoa sivustosta