| | |
New Thread is not allowing proper Paint Events
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
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:
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:
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
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:
C# Syntax (Toggle Plain Text)
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:
C# Syntax (Toggle Plain Text)
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
![]() |
Similar Threads
- Playing .Wav/MIDI files in a Visual Basic Program (Visual Basic 4 / 5 / 6)
- Send data on a serial port (C++)
- Opinions? javascript/php/etc and programming standards (JavaScript / DHTML / AJAX)
- New Beginner (C++)
- nullpointer exception...HELP!!! (Java)
- Question about join of thread. (Java)
- Need help in thread handling pplease read (Java)
Other Threads in the C# Forum
- Previous Thread: Differences between Delegates and Events
- Next Thread: how to call these functions?
| Thread Tools | Search this Thread |
.net access ado.net algorithm array barchart bitmap box broadcast buttons c# chat check checkbox client color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel file files form format forms function gdi+ httpwebrequest image index input install java label list listbox listener mandelbrot math mouseclick mysql nargalax networking object operator path photoshop picturebox pixelinversion polynomial post prime programming radians regex remote remoting richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml





