StrataFrame Forum

Newbie Question

http://forum.strataframe.net/Topic7152.aspx

By Ben Kim - 2/23/2007

Hello all,

Sorry for the newbie question and I imagine the answer is no.  I have a method I want to run after the form is completely loaded.  What I mean by Loaded is all controls have been drawn and the form is waiting for user input.  I can see running this method in the background so perhaps a worker thread is appropriate here? 

My question is this:  Is there a standard form event I can use to call my method after the form has been completely drawn?  I have tried after InitializeComponents in the New event, Load, Activate, GainFocus (with a flag stating its the initial load), etc. and none of these events allow the form to completely draw prior to calling my method that takes between 5-10 seconds to run.

Ideas?

Ben

By StrataFrame Team - 2/26/2007

You can create a System.Threading.Timer within the Load event and have it wait about 250ms before processing your callback.  Also, the callback will already happen on another thread (it doesn't invoke on the main thread), so there's no need to create another thread explicitly.  Or, you can put your code in the Shown() event... I believe that's the one that fires after the SetVisibleCore() has been called on the form to draw everything.