Lemon Posted March 4, 2004 Posted March 4, 2004 Hey, Is it possible take a 'screenshot' of the stuff that is behind of an partically form. And then setting it as background, to get a 'fake' transparent effect? (idea from: adobe splash screens) Quote
Leaders dynamic_sysop Posted March 4, 2004 Leaders Posted March 4, 2004 in a Class module ( or below the End Class statement of your Form ) .... Public Class _win32 Public Declare Function SetLayeredWindowAttributes Lib "user32.dll" (ByVal hwnd As IntPtr, ByVal crKey As Integer, ByVal bAlpha As Byte, ByVal dwFlags As Integer) As Integer Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As IntPtr, ByVal nIndex As Integer) As Integer Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As IntPtr, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer Public Const GWL_EXSTYLE As Integer = -20 Public Const LWA_COLORKEY = &H1 Public Const LWA_ALPHA = &H2 Public Const WS_EX_LAYERED = &H80000 End Class then in your Form ( in the Form_Load event ) ... Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.BackColor = Color.Snow '/// set the form's colour to a different colour than any control holds ( to prevent the controls dissappearing ) Dim style As Integer = _win32.GetWindowLong(Me.Handle, _win32.GWL_EXSTYLE) style = style Or _win32.WS_EX_LAYERED _win32.SetWindowLong(Me.Handle, _win32.GWL_EXSTYLE, style) _win32.SetLayeredWindowAttributes(Me.Handle, ColorTranslator.ToWin32(Me.BackColor), 250, _win32.LWA_COLORKEY Or _win32.LWA_ALPHA) End Sub Quote
Lemon Posted March 5, 2004 Author Posted March 5, 2004 (edited) OMG thx, thats exactly what i need Now i'm gonna try understand all the code init :D thx again you are a god :) Edited March 5, 2004 by Lemon Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.