This isn't optimal by any means, but you could use OnPaint():

protected override void OnPaint(PaintEventArgs e) {

        if(!IsInitialized) {

                InitializeAndShowProgress();
                IsInitialized = true;
        }
}

WM_PAINT is the first message recieved by a loaded form (AFAIK), but I'm not
sure if there's some internal event that fires between Load and Paint.

Jim

> -----Original Message-----
> From: Simon Robinson [mailto:[EMAIL PROTECTED]]
> Sent: 24 May 2002 11:51
> To: [EMAIL PROTECTED]
> Subject: [DOTNET] Displaying info on loading forms
>
>
> Two purposes to this post:
> 1. Ask a question
> 2. Mention some rather amusing behavior in Windows Forms.
>
> Questions runs... Is there any event in Windows Forms that
> is raised after a Form has been loaded? My form does a lot
> of processing at startup and I'd like it to display itself then
> do its processing, reporting to the user on its progress as it
> does it.  I tried the Load event but that seems to get invoked
> just before the form is displayed.
>
> Amusing behavior runs... While looking for solutions to the
> above question I tried using the Activated event. The form
> contains a Panel and progress report would be written in the panel
> using Graphics.DrawString().  The result?
> 1. The main title bar of the form gets displayed (but not
> the rest of the form)
> 2. The calls to Graphics.DrawString() write the text over
> whatever happened to be on the screen where the form is
> going to be displayed. You end up with VS.NET sitting
> there with all this writing scrawled over it.
> 3. The form appears - but now without the writing.
> This quite tickled me - though I'm intrigued as to why
> it happened. I bet the Windows Forms team didn't
> intend it.
>
> Simon
> ---------------------------------------------------------------
> Simon Robinson
> http://www.SimonRobinson.com
> ---------------------------------------------------------------
>
> You can read messages from the DOTNET archive, unsubscribe
> from DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.
>

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to