with an override

P

Peter Simon

I tried to do the same because showing several windows in layers cause flickers, and I found a possible solution. Override SetVisibleCore like this:

protected override void SetVisibleCore(bool value)
{
if (initialVisible)
base.SetVisibleCore(value);
}

After Show() initialVisible must be set as true, and that's all.



3po wrote:

another solution
29-May-09

You are required to be a member to post replies. After logging in or becoming a member, you will be redirected back to this page.

Previous Posts In This Thread:

Opening a form hidden
H

I have searched for answer to this question on the net but surprisingly n
clear answer has come up. How can I open a form hidden in vb.net

Thank

Regards

Re: Opening a form hidden

Simply do not call the form's 'Show' or 'ShowDialog' method and do not set
its 'Visible' property to 'True'. You can use the form object by
instantiating the form class

\\
Dim f As New FooForm(
...
//

The form remains invisible until you show it

--
M S Herfried K. Wagne
M V P <URL:http://dotnet.mvps.org/
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Re: Opening a form hidden

When 'Load' is executed, the form is still not visible. In addition, the
form is shown after the 'Load' event has been executed

--
M S Herfried K. Wagne
M V P <URL:http://dotnet.mvps.org/
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Re: Opening a form hidden
If the load event fires, there must have been a .Show before. Doesn'
make sense to Hide something because it is about to be Shown. Instead,
would not show it

Armin

A Form is a visual element in order to display something or acceptinput.
A Form is a visual element in order to display something or accep
input. Showing an invisible thing is a contradiction in itself

If the problem is the application framework that only allows a Form as
the startup object, disable it and write your own sub Main to get full
control over your own application. Then you can show the Form only if it
has to be shown

Armin

You can set the position of the form off of the display, like to the right of
You can set the position of the form off of the display, like to the right
of the user's screen, then move it back when you want to show it. Works like
a charm for me

If you do this, don't let the cat sit on the right side of the monitor, so
he's not harmed when he's hit by the form flying over there... ;-

RobinS
GoldMail, Inc
-----------------------------

Be careful of systems with more than one monitor.
Be careful of systems with more than one monitor. What is off th
display on your system might be visible on another display on someon
else's system

wrote:

I think he means main form (initial one)...
I think he means main form (initial one)... It is not easy, becaus
setting Invisible=True is not working here..

There is official article at MSDN named "Setting a Form to B
Invisible at Its Inception", but I found easier solution to se
opacity to 0% in designer and then just change it to 100% - effect i
same, but it is easier to implement. Only problem could be if you wan
your application to run on older 9x clients - as far as I remember
opacity is supported from Windows 2000.

Re: Opening a form hidden
Use Me.Hide() into your form_load event. Or try to set form's
visibility property to false.

Re: Opening a form hidden
Yes, setting visibility property to false might not work for some
reason (?), then setting opacity value to %0 seems a good alternative.

Give me a teensy amount more credit than that.
Give me a teensy amount more credit than that. It pulls the info for the
screen, and positions the forms off the screen, regardless of how many
monitors, or the resolution, etc. :)

RobinS.
-------------------------------------

Re: Opening a form hidden
OK, in this case setting opacity to %0 seems really working way for
hiding form by default as stated previously.

Re: Opening a form hidden

I usually send it to -10000, if they that many monitors than they
deserve to see everything :)

But in reality, I haven't sent a form off screen since my VB6 days,
now I usually just toggle the opacity between 0% and 99% when I have a
reason to hide and show a form. I do agree with Armin that Sub Main is
a better choice if no interaction is required, or the OP could just
create a service depending on the purpose of the app. And in case
anyone's wondering, whenever I use opacity I only go to 99%, going to
100% causes a flicker because of the way Windows paints forms (it has
two modes, one for opacity and one for no opacity, switching between
the two will flicker the form on painting).

Thanks,

Seth Rowe [MVP]

In my last post I also wanting to thank you for searching for theanswer before
In my last post I also wanting to thank you for searching for the
answer before posting, but it slipped my mind. It's very much
appreciated when posters do the legwork before posting.

Thanks,

Seth Rowe [MVP]

Re: Opening a form hidden
This seems to scream "bad UI design"' to me.

Armin's got the right idea here....
Armin's got the right idea here....

Instead of playing tricks with the form (opacity, visibility, position,
etc.). Just take control of your application by using a Sub Main and then
you can launch the form whenever you need it.

While there are other *solutions*, they all scream of "hack".

-Scott



Personally, I wouldn't look at much that was standard operating procedure in
Personally, I would not look at much that was standard operating procedure in
VB 6.0 as a reason for doing it that way now. :)

Re: Opening a form hidden
en
no

Actually, moving the form offscreen has been recommended my the .NET
dev team for preventing flicker and drawing errors for MDI child
forms. Also, in more classic programming, moving forms and panels
offscreen was the recommended approach (take a look at how the VB6
wizard handles panels). Not saying they aren't "hacks", just sharing
some interesting tidbits. :)

Thanks,

Seth Rowe [MVP]

You did read my earlier post right?
You did read my earlier post right? I certainly don't advocate moving
the forms off screen to hide them (except in certain cases of mdi
children where nothing else will work), I was just sharing some
interesting information / history.

Thanks,

Seth Rowe [MVP]

Thanks! There's nothing like criticism without advice!
Thanks! There is nothing like criticism without advice!

RobinS.
GoldMail, Inc.
-------------------

I've already provided the advice if you took the time to read the rest of the
I have already provided the advice if you took the time to read the rest of
the thread.

I did no such thing. I expressed my opinion about using VB 6 practices in .
I did no such thing. I expressed my opinion about using VB 6 practices in
..NET applications. I do not see what you think I did not read. Your post was
short and quite clear.

-Scott

Re: Opening a form hidden
..
,
-)
ly

Read as well as you read the thread? After all you criticized my post
without even taking the time to actually read what I wrote.....

Thanks,

Seth Rowe [MVP]

Of course I did, but in chronological order.
Of course I did, but in chronological order. Had this post said "keep
reading for some advice", I wouldn't have posted a response.

You're pretty entertaining.

RobinS.
GoldMail, Inc.
-------------------------------

You not too bad for a laugh yourself, Robin!
You not too bad for a laugh yourself, Robin!

another solution
You are required to be a member to post replies. After logging in or becoming a member, you will be redirected back to this page.


Submitted via EggHeadCafe - Software Developer Portal of Choice
Using VSTO Add-In To Automate Frequent Excel 2007 Tasks
http://www.eggheadcafe.com/tutorial...60-39a86ccab5d6/using-vsto-addin-to-auto.aspx
 
A

Armin Zingler

Am 10.05.2010 10:47, schrieb Peter Simon:
I tried to do the same because showing several windows in layers cause flickers, and I found a possible solution. Override SetVisibleCore like this:

protected override void SetVisibleCore(bool value)
{
if (initialVisible)
base.SetVisibleCore(value);
}

After Show() initialVisible must be set as true, and that's all.


Instead of this hack, I'd remove the cause of the Form becoming visible: Showing it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top