473,378 Members | 1,175 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Can opacity/transparency be adjusted within components?

I know that I can change the opacity of an entire form, but is there a
way to control opacity to specific controls or components?

For example I want to create a form that is semi-transparent (maybe
looks like a sheet of green glass) but has elements or graphics on top
that I want to be opaque. Perhaps I want the sheet of glass to have
writing or other graphics "painted" on the surface. Is there some way
to mix varying transparencies within a form?
Feb 19 '06 #1
12 3747
http://www.kjmsolutions.com/downloads/transparent.zip

I hope this gets you started.

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com

"Patrick Dugan" <pa******@netins.net> wrote in message
news:uW**************@TK2MSFTNGP09.phx.gbl...
I know that I can change the opacity of an entire form, but is there a way
to control opacity to specific controls or components?

For example I want to create a form that is semi-transparent (maybe looks
like a sheet of green glass) but has elements or graphics on top that I
want to be opaque. Perhaps I want the sheet of glass to have writing or
other graphics "painted" on the surface. Is there some way to mix varying
transparencies within a form?

Feb 19 '06 #2
That is interesting but not what I was wanted. I want the form to be
transparent so that the desktop background appears through it while
other elements on that same form are opaque.

vbnetdev wrote:
http://www.kjmsolutions.com/downloads/transparent.zip

I hope this gets you started.

Feb 19 '06 #3
Hi Patrick,

Any controls on a form that have the same BackColor property as the
TransparencyKey property of the Form will be displayed Transparent. All
other controls will be displayed Opaque. So, firstly set your Form's
Transparency Key property to a particular color. Then set your Form's
BackColor to the same color as the TransparencyKey color. Now, to display
any control as opaque, make sure it's BackColor is different from the Form's
BackColor.

HTH,

Cerebrus.
"Patrick Dugan" <pa******@netins.net> wrote in message
news:43**************@netins.net...
That is interesting but not what I was wanted. I want the form to be
transparent so that the desktop background appears through it while
other elements on that same form are opaque.

vbnetdev wrote:
http://www.kjmsolutions.com/downloads/transparent.zip

I hope this gets you started.

Feb 20 '06 #4
Thanks for the reply. I'm not trying to make the form (or parts of it)
completely transparent. I want to adjust the opacity level (0% through
100%) on the form and use different opacity levels for other controls or
graphics within that form. Transparent colors are all or nothing and do not
contain a percentage of transparency. Since there are no opacity settings
for anything besides the form I assume that this is simply not possible.

"Cerebrus99" <zo*****@sify.com> wrote in message
news:ui*************@TK2MSFTNGP12.phx.gbl...
Hi Patrick,

Any controls on a form that have the same BackColor property as the
TransparencyKey property of the Form will be displayed Transparent. All
other controls will be displayed Opaque. So, firstly set your Form's
Transparency Key property to a particular color. Then set your Form's
BackColor to the same color as the TransparencyKey color. Now, to display
any control as opaque, make sure it's BackColor is different from the
Form's
BackColor.

HTH,

Cerebrus.
"Patrick Dugan" <pa******@netins.net> wrote in message
news:43**************@netins.net...
That is interesting but not what I was wanted. I want the form to be
transparent so that the desktop background appears through it while
other elements on that same form are opaque.

vbnetdev wrote:
> http://www.kjmsolutions.com/downloads/transparent.zip
>
> I hope this gets you started.
>


Feb 20 '06 #5
Hi Patrick,

I saw your post and thought that this might be helpful:

http://www.bobpowell.net/transcontrols.htm

Chris

Feb 20 '06 #6
Thanks Chris. I guess I'm not explaining what I am trying to do very well.
If I create a form and give it an opacity of 50% the form will appear
translucent on the desktop. Any control on that form will also be 50%
translucent.
I want the form itself to be 50% translucent but a control or picturebox on
that form to be completely opaque. I cannot make a control opaque while the
form is translucent but I want to. As an example think of an old green
glass coke bottle. The bottle itself is translucent but the graphics on the
bottle are opaque. I can see through the green glass but not through the
graphics. I want the form (or the background of that form) to be
translucent (not transparent) but have graphics on top that are opaque.

"Chris Dunaway" <du******@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Hi Patrick,

I saw your post and thought that this might be helpful:

http://www.bobpowell.net/transcontrols.htm

Chris

Feb 20 '06 #7
Sorry, I re-read it and the link I posted does not help. I don't know
how to do what you want.

Feb 20 '06 #8
I found this code which can be put in the sub New of a form:

If (Me.Site Is Nothing) OrElse (Me.Site.DesignMode = False)
Then
Me.frontForm = New Form
Dim tempList As New ArrayList(Me.Controls.Count)

For Each c As Control In Me.Controls
tempList.Add(c)
Next

For Each c As Control In tempList
Me.Controls.Remove(c)
Me.frontForm.Controls.Add(c)
Next

Me.Controls.Clear()
Me.AddOwnedForm(Me.frontForm)
Me.frontForm.BackColor = Color.Magenta
Me.frontForm.TransparencyKey = Color.Magenta
Me.frontForm.Show()
Me.SendToBack()
Me.frontForm.BringToFront()
Me.frontForm.Bounds = Me.Bounds
Me.frontForm.ShowInTaskbar = False
Me.frontForm.FormBorderStyle =
Windows.Forms.FormBorderStyle.None
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
End If
then set the form's opacity to something. It gives the desired effect,
but a way to move the form needs to be found.

Feb 20 '06 #9

What is the "frontform" in "Me.frontForm" ? I have tried changing the name
of the form to "frontForm" but that isn't recognized. The editor doesn't
recognize the "frontForm" associated with "Me" Is there an import I need to
add? I added "system.windows.forms.form" but it made no difference either.
I'd like to test that code but it won't compile at the moment.
"Chris Dunaway" <du******@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I found this code which can be put in the sub New of a form:

If (Me.Site Is Nothing) OrElse (Me.Site.DesignMode = False)
Then
Me.frontForm = New Form
Dim tempList As New ArrayList(Me.Controls.Count)

For Each c As Control In Me.Controls
tempList.Add(c)
Next

For Each c As Control In tempList
Me.Controls.Remove(c)
Me.frontForm.Controls.Add(c)
Next

Me.Controls.Clear()
Me.AddOwnedForm(Me.frontForm)
Me.frontForm.BackColor = Color.Magenta
Me.frontForm.TransparencyKey = Color.Magenta
Me.frontForm.Show()
Me.SendToBack()
Me.frontForm.BringToFront()
Me.frontForm.Bounds = Me.Bounds
Me.frontForm.ShowInTaskbar = False
Me.frontForm.FormBorderStyle =
Windows.Forms.FormBorderStyle.None
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
End If
then set the form's opacity to something. It gives the desired effect,
but a way to move the form needs to be found.

Feb 21 '06 #10
I'm sorry. That is just another variable declared at the top of the
form:

Dim frontFomr As Form

The code just creates another form (frontForm), sets its background to
Magenta and makes that color transparent with the transparency key. It
then positions form directly over the top of the semi transparent form.
So there are two forms. The one on the bottom is the semi-transparent
one, the one on the top (frontForm) is completely transparent except
for the controls.

It's really kind of a hack.

Feb 21 '06 #11
Holy **** it works! Thanks! I have some code that can move the form:
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
' This allows you to move the form around and still allow other mouse
capture events to come through...
Dim msg As New Message
Const WM_SYSCOMMAND As Long = &H112
Const MOUSE_MOVE As Long = &HF012
msg.HWnd = Me.Handle
msg.Msg = WM_SYSCOMMAND
msg.WParam = New IntPtr(MOUSE_MOVE)
Me.Capture = False
Call Me.WndProc(msg)
End Sub
However when I use this the form itself moves but the controls do not. Very
weird to see that. Still a neat trick though. Thanks!

"Chris Dunaway" <du******@gmail.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
I'm sorry. That is just another variable declared at the top of the
form:

Dim frontFomr As Form

The code just creates another form (frontForm), sets its background to
Magenta and makes that color transparent with the transparency key. It
then positions form directly over the top of the semi transparent form.
So there are two forms. The one on the bottom is the semi-transparent
one, the one on the top (frontForm) is completely transparent except
for the controls.

It's really kind of a hack.

Feb 21 '06 #12
When you move one form, you would have to move the other at the same
time.

Feb 22 '06 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Andy Smith | last post by:
I am trying to get a background within a table transparent. I am using: style="filter:alpha(opacity=65);" The only problem is that everything within the table is now faded. Not my intention. I...
3
by: Marek Mänd | last post by:
This posting will express my concern about the future of css3 forthcoming recommendation. I think for long time now, that the current implementation of CSS attribute opacity is less than usable...
5
by: vBOT | last post by:
Hi all, I have an odd shaped graphic I would like to use as my interface (see it here at http://www.mokee.com/vbot/ver3/face.jpg) The part I want to be transparent on the image is red. I set the...
1
by: Juleke | last post by:
Hello, When I'm using the opacity property for showing a form I can see my application on the computer. But If I'm connecting to this machine via Remote Access (VNC). I see nothing of my...
1
by: Brian | last post by:
If your like me, you have probably seen way too many demos of the opacity property of a form. Well I finally have a need for it and I am having an issue. I am trying to create a splash screen...
4
by: beaker | last post by:
Hello, Is there a way to alter the opacity of an MDI child window? I've tried setting the Opacity property, but it has no effect on the children (fine for the parent though). (I want to...
5
by: Webmaster | last post by:
The following style sets the opacity or semi-transparency in Mozilla and Explorer browsers for an image: #myImage{ filter: alpha(opacity=50); -moz-opacity:0.50; opacity: 0.50; } <img...
5
by: Rudi Hausmann | last post by:
Hi! I want to "paint" some blocks with text in it. As the box can overlap I want the text to be transparent using opacity. Though, the text shall stay well visible. Here is what I produced so...
4
Unicron
by: Unicron | last post by:
Hi everyone. The title says it all. I have a collection of PNGs with drop shadows. They work great in IE7 and FF. If I add filters in my stylesheets, such as icon { filter:...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.