Click here to Skip to main content
15,915,702 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All...

I am developing an application .net 2.0 (windows Forms - MDI Application.) I need to display mails in a DataGridView with Image (Read and Unread Image). I have used a DataGridViewImage column and i trying to put the image in that column in Cell_Painting event. But after displaying the image the grid is behaving weird. I can see the frame below the grid,(tranparent). When i move the Form, it will become perfect. Also am not able to view ant message box which comes over the window.

Almost 20 mails will come in one second, the grid is getting hanged while the mails are coming. Please anyonehelp me..

I tried with Invalidate() and Refresh(). But nothg works for me....
In cellpainting event of the grid............

If (.ColumnIndex = 1 )
{
e.value=Image.FromFile(f:\Read1.bmp;)
}

}
reply
Posted

Sounds like you need to move the processing/downloading of the mail messages into a background thread, this will stop the UI hanging while the mail messages are being received.
 
Share this answer
 
I tried with threading also. But the problem happens in the Cell_painting event. when i comment the following code,it works perfectly,(with a red cress mark in place of image), But i need to display the image.


e.value = MyApplication.global::prperties.resource.ReadImage;
e.drawscaledimage(......) ;


I am stuck up here..please help me.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900