By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,812 Members | 856 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,812 IT Pros & Developers. It's quick & easy.

Opacity Property

P: n/a
As you will probably guess, I'm just starting out with VB.net although I'm a
long time VB developer. I was playing around with the Opacity property of a
form and have found that I can set the property at design time or in code
just fine, but as soon as I move the form to a new location on the screen,
it becomes completely opaque. If I then try to set the opacity property
again, I get an error message. Any idea what's going wrong?

Bob
Nov 20 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
"Robert A. Boudra" <rb*****@comcast.net> wrote...
As you will probably guess, I'm just starting out with VB.net although I'm a long time VB developer. I was playing around with the Opacity property of a form and have found that I can set the property at design time or in code
just fine, but as soon as I move the form to a new location on the screen,
it becomes completely opaque. If I then try to set the opacity property
again, I get an error message. Any idea what's going wrong?


Hi Bob... I've got a suggestion though :-) You could show the line you are
using to set the opacity and second you could let us know what the error
message is.

If you want to test it more yourself, start a project, add a form, set the
opacity and run the program. If that gives you an error I would be
surprised but if it does you have limited the number of other factors that
may be causing the error.

Does doing nothing more than the following cause the error? What error?

Me.Opacity = .5

Tom
Nov 20 '05 #2

P: n/a
Tom:

I have a the following code in a Button Click event of on a form:

If Me.Opacity > 0.05 Then

Me.Opacity -= 0.05

End If

As I click this button the Opacity of the form continues to get smaller
(more transparent). However, if I stop and drag the form to a new location
on the screen, it immediately reverts to completely Opaque. If I then click
the button again I get this message:

"An unhandled exception of type 'System.ComponentModel.Win32Exception'
occurred in system.windows.forms.dll
Additional information: The parameter is incorrect"

and execution breaks on the "Me.Opacity -= 0.05" line of code above.

Thanks,

Bob

"Tom Leylan" <ge*@iamtiredofspam.com> wrote in message
news:O7**************@TK2MSFTNGP09.phx.gbl...
"Robert A. Boudra" <rb*****@comcast.net> wrote...
As you will probably guess, I'm just starting out with VB.net although I'm
a
long time VB developer. I was playing around with the Opacity property
of a
form and have found that I can set the property at design time or in
code just fine, but as soon as I move the form to a new location on the screen, it becomes completely opaque. If I then try to set the opacity property
again, I get an error message. Any idea what's going wrong?


Hi Bob... I've got a suggestion though :-) You could show the line you

are using to set the opacity and second you could let us know what the error
message is.

If you want to test it more yourself, start a project, add a form, set the
opacity and run the program. If that gives you an error I would be
surprised but if it does you have limited the number of other factors that
may be causing the error.

Does doing nothing more than the following cause the error? What error?

Me.Opacity = .5

Tom

Nov 20 '05 #3

P: n/a
If Me.Opacity > 0.05 Then

Me.Opacity -= 0.05

End If


This works for me and doesn't give any errors after dragging the form and
re-clicking the button.
Nov 20 '05 #4

P: n/a
* "Robert A. Boudra" <rb*****@comcast.net> scripsit:
As you will probably guess, I'm just starting out with VB.net although I'm a
long time VB developer. I was playing around with the Opacity property of a
form and have found that I can set the property at design time or in code
just fine, but as soon as I move the form to a new location on the screen,
it becomes completely opaque.
This should not occur. Maybe you need to update your graphics card drivers.
If I then try to set the opacity property
again, I get an error message. Any idea what's going wrong?


Text of the error message?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #5

P: n/a
>>Maybe you need to update your graphics card drivers.<<

That was it! I updated my Graphics driver, and now it works fine. Thanks!

Bob

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bq*************@ID-208219.news.uni-berlin.de...
* "Robert A. Boudra" <rb*****@comcast.net> scripsit:
As you will probably guess, I'm just starting out with VB.net although I'm a long time VB developer. I was playing around with the Opacity property of a form and have found that I can set the property at design time or in code just fine, but as soon as I move the form to a new location on the screen, it becomes completely opaque.
This should not occur. Maybe you need to update your graphics card

drivers.
If I then try to set the opacity property
again, I get an error message. Any idea what's going wrong?


Text of the error message?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #6

P: n/a
* "Robert A. Boudra" <rb*****@comcast.net> scripsit:
Maybe you need to update your graphics card drivers.<<


That was it! I updated my Graphics driver, and now it works fine. Thanks!


Sometimes even random thoughts help.

;-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.