?
Solved

Transparent form

Posted on 2002-04-11
9
Medium Priority
?
220 Views
Last Modified: 2010-05-02
Hi to you all,

Does anybody know how I can make a form completly transparent. Without transparancy of the other objects in that form.
So that the buttons seems to be placed by theire own on the screen.

Thanks
0
Comment
Question by:theo kouwenhoven
9 Comments
 
LVL 2

Accepted Solution

by:
Ber earned 200 total points
ID: 6935382
The following should do the job

In a Module Add the Following Declarations

Public Const GWL_EXSTYLE = (-20)
Public Const WS_EX_TRANSPARENT = &H20&
Public Const SWP_FRAMECHANGED = &H20
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const SWP_SHOWME = SWP_FRAMECHANGED Or _
SWP_NOMOVE Or SWP_NOSIZE
Public Const HWND_NOTOPMOST = -2

Declare Function SetWindowLong Lib "user32" _
Alias "SetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Declare Function SetWindowPos Lib "user32" _
(ByVal hwnd As Long, ByVal hWndInsertAfter _
As Long, ByVal x As Long, ByVal y As Long, _
ByVal cx As Long, ByVal cy As Long, _
ByVal wFlags As Long) As Long

'I placed this code behind a button for this example but
'It can be placed pretty much wherever you need it

Private Sub Command1_Click()
SetWindowLong Me.hwnd, GWL_EXSTYLE, _
WS_EX_TRANSPARENT
SetWindowPos Me.hwnd, HWND_NOTOPMOST, _
0&, 0&, 0&, 0&, SWP_SHOWME
End Sub

Cheers...
Ber...
0
 
LVL 2

Expert Comment

by:Ber
ID: 6935411
P.S. The ShowInTaskbar property should be set to False and the BorderStyle to 0-None

Cheers...
Ber...
0
 
LVL 16

Author Comment

by:theo kouwenhoven
ID: 6937250
Hi Ber,

Nice trick, but not only the window is invisible but also all label-objects?

Why
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6938450
Cause labels are drawing objects not "real" objects and they are drawn in the same layer as form does.
0
 
LVL 2

Expert Comment

by:Ber
ID: 6938909
This is not really a solution but it might help

Add a text box to the the form
set its properties to the following

Text1.Appearance = 0
Text1.BorderStyle = 0
Text1.BackColor = &H8000000F
Text1.Locked = True

this will look like a label and the user will not be able to type in it...

Cheers...
Ber...
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6939031
Ber, it would be possible to hide caret with API stuff also.
0
 
LVL 2

Expert Comment

by:Ber
ID: 6940340
Good point richie

To hide the caret use the following API

place the following in a module
Declare Function HideCaret Lib "user32" _
(ByVal hWnd as Long) As Long

Then set the Gotfocus event in the text Box as follows

Private Sub Text1_GotFocus()
HideCaret (Text1.hWnd)
End Sub
0
 
LVL 8

Expert Comment

by:glass_cookie
ID: 6941243
Hi!

Here's a file for you ver the net:

Download...
http://www.vb-helper.com/HowTo/transimg.zip
Description: Make a "transparent" form (9K)

There' are controls on it to amke it look as if theys veen placed on a form.  Is that what you're looking for?

That's it!

glass scookie : )
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6948933
Hi murphey2 any progress/comment?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question