RSS Forums RSS
Please support our C# advertiser: Programming Forums
Views: 3500 | Replies: 1
Reply
Join Date: Jul 2003
Location: Bamberg, Germany
Posts: 117
Reputation: Iron_Cross is an unknown quantity at this point 
Rep Power: 6
Solved Threads: 2
Iron_Cross's Avatar
Iron_Cross Iron_Cross is offline Offline
Junior Poster

New Thread is not allowing proper Paint Events

  #1  
Jun 16th, 2005
I've got a project going where I need to do some extensive searching, so I decided it would be best to put that code into a new thread. To make it a little more user friendly I decided to pop up a dialog box with a little animated image informing them that it is searching.

The problem lies in the fact that when I do this, the image will not load. I was using a PictureBox to display the image. So then I decided to try and ghettofy it and just set the dialog's backgroundimage property to the image. Which worked just fine.

But since I would like to use a the animated image, I would like to find out why it's not painting properly.

The code I'm using is:
SearchDialog l_sd = new SearchDialog();
l_sd.Show();

// Search is the method that does all the processing
Thread l_t = new Thread(new ThreadStart(Search));
l_t.Start();
l_t.Join();

l_sd.Close();

So Just for kicks I deicded to NOT use a thread to do the work, but the concept was still the same (1. Show Dialog 2. Process stuff 3. Close Dialog) yet I STILL had the same problem. It will only display the picture when I use the BackGroundImage property, not a PictureBox.

The new code looked like:
SearchDialog l_sd = new SearchDialog();
l_sd.Show();

/*
 * All the searching and crap was here
 */

l_sd.Close();

Just to make matters worse, I found out that it won't even display a label. The ONLY thing it will display is the actual form, and the form background. I just don't know why it won't display labels, pictures, or anything I have heavy processing directly after the show() method.

Any help is appreciated. Thanks
elitehackers.info
Today's Penny-Arcade!
Pain is weakness leaving the body!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2005
Posts: 1
Reputation: amirmi is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
amirmi amirmi is offline Offline
Newbie Poster

Help Re: New Thread is not allowing proper Paint Events

  #2  
Sep 19th, 2005
Did you found the solution?

I'm Having the same problem, im doing a lengthy operation (mail merge via the code), and wanted to display an animated gif, but it didnt show until i did a this.Refresh() call - but then the gif isnt really moving...

if u managed to solve it - mail me back - please!!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 11:57 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC