Transparent Form within a Form

greko

New member
Joined
Nov 1, 2007
Messages
2
Programming Experience
Beginner
Dear all,

First of all I am new to this forum, and a newbie in VB.Net
I would just like to ask if someone here may have some ideas as to
making a transparent form within a form(not MDI forms just plain forms).

I have managed to add a form within a form but the transparency key
and opacity doesn't work.

any ideas are much appreciated.
 
Hello,

The opacity property of a form handles the transparency of the form. Full
transparency starts from 0.0 .. and 1.0 is complete opacity.

for example, on a button click you can reduce the form opacity using the
following code.

Me.Opacity = Me.Opacity - 0.1

When the TransparencyKey property is assigned a Color, the areas of the
form that have the same BackColor will be displayed transparently. Any
mouse actions, such as the click of the mouse, that are performed on the
transparent areas of the form will be transferred to the windows below the
transparent area.

Try this:

Me.TransparencyKey = Me.BackColor

I hope this will help.

Regards,
Allen Smith
Software Engineer
ComponentOne LLC
www.componentone.com
 
Thank you so much for the fast reply.

I tried this code:

VB.NET:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim frm As Form
        Dim myForm1 as New Form

        myForm1.TopLevel = False

        myForm1.Opacity = 0.5    'This line here doesn't work,It doesn't make the child form semi transparent
        myForm1.Width = 500
        myForm1.Height = 300
        myForm1.Visible = True
        myForm1.Name = "myForm1"
        myForm1.Location = New Point((Me.Width / 2) - (myForm1.Width / 2), (Me.Height / 2) - (myForm1.Height / 2))
        myForm1.Show()

        Me.Controls.Add(myForm1)



    End Sub

I wanted to make myForm1 semi-Transparent and When I RollOver it,
It becomes completely Opaque.

How can I do that? Is it possible?
 
Back
Top