Avatar of JGSchmidt
JGSchmidt

asked on 

Controlling a second form on a separate thread in C#

From my main form I would like to start an new form in a separate thread.
This second form will do its own thing while the main one is continuing with its activities.
I want to send a message from the main form to the second one when I want it to close.
I want it to perform a close-down routine  so I can not just send it a kill message.

I am somewhat comfortable with background threads from the MSDN examples.
I am not at all comfortable with delegates. I can cut and paste delegate code but still have only a small clue how it actually works when it comes to cross-thread communication.

I imagine a class with two public methods: ThreadFormStart(parms) and ThreadFormStop(parms). The rest of the implementation should be hidden inside that class.

My initial application is a animation that fades in, hangs around a while and then fades out on command, while the main form is still active. Naturally everything should be thread-safe, etc.

Assume I have never heard of C function pointers.

Thanks for any help.
.NET ProgrammingC#

Avatar of undefined
Last Comment
JGSchmidt

8/22/2022 - Mon