Starting a process after the form is visible?

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

Hi All,

I want to do the following, show the form and after the form is visible do
some processing, so i can show the process on the form. But the problem is
that i can't seem to find an event that get fired after the form is visible.
Am i missing something?

I'm using c# for this.

Please help, thanks in advance,
Richard.
 
hello, Richard

Try Form.Activated event, you have to add this eventhandler by yourself.
And notice, every time the form is shown, the event will get fired, even
when you dismiss the notification alert (such as power low notification)
will trigger this event.

--
Best Regards,
Jan Yeh

eMVP, MCAD, .NETcf Developer
Mobile Mind Company @ Taiwan
http://blog.mvpcn.net/janyeh
 
Hi Jan,

Thanks for your quick reply.

I tried that, but the event get's fired before the window is actually
visible, is there any way to do it?

Richard.
 
Hi Richard,

Will Form.GotFocus event fit your requirement?
You can check "Control.GotFocus" section in MSDN Library for detail.
It will explain the difference between Form.Activated and Form.GotFocus
and the order of form events triggered.

HTH..

--
Best Regards,
Jan Yeh

eMVP, MCAD, .NETcf Developer
Mobile Mind Company @ Taiwan
http://blog.mvpcn.net/janyeh
 
Here's a hack that should do the trick - Over die the form's OnPaint event.
In your form's class, declare a bool that is initialized to false. In the
OnPaint over ride, if the bool is false, then do what ever it is that you
need to do upon first time visible activation of the application and then
set the boolean true so that your one time code doesn't execute again.
===========
Richard Lewis Haggard
www.haggard-and-associates.com
 
Back
Top