Hi, I´m programming a .NET Compact Framework application which shows maps on a PDA.
I´ve created an ad hoc component that paints it´s own piece of the whole map, using several of this components the big picture is composed. I did it this way to avoid the latency of painting the whole map in a single step.
What I would like to do know is to paint this pieces in their own thread, so the map appears to grow as a single entity and (also, and more important) to avoid freezing the rest of the user interface.
Right know each piece of the map is painted in its onPaint method. My idea is to, somehow, tell the system "execute this code in a thread please".
Something like:
protected override void OnPaint(PaintEventArgs e)
{
// <code to be executed in a thread>
e.Graphics.paintTHis();
e.Graphics.paintThat();
whateverItTakesToPaintThisPieceOfTheMap();
// </code to be executed in a thread>
}
Do you know how to do this? Or is my approach simply wrong?
Thanks for your time!