Click here to Skip to main content
15,906,708 members
Home / Discussions / C#
   

C#

 
GeneralRe: passing by reference v.s. passing by value Pin
Guffa1-Oct-08 3:41
Guffa1-Oct-08 3:41 
GeneralRe: passing by reference v.s. passing by value Pin
George_George3-Oct-08 1:18
George_George3-Oct-08 1:18 
GeneralRe: passing by reference v.s. passing by value Pin
N a v a n e e t h2-Oct-08 16:50
N a v a n e e t h2-Oct-08 16:50 
GeneralRe: passing by reference v.s. passing by value Pin
George_George3-Oct-08 1:21
George_George3-Oct-08 1:21 
GeneralRe: passing by reference v.s. passing by value Pin
George_George30-Sep-08 0:01
George_George30-Sep-08 0:01 
GeneralRe: passing by reference v.s. passing by value Pin
George_George30-Sep-08 0:08
George_George30-Sep-08 0:08 
QuestionWS-Addressing for routing Pin
George_George27-Sep-08 23:06
George_George27-Sep-08 23:06 
QuestionQuestion on threads Pin
Dewald27-Sep-08 22:06
Dewald27-Sep-08 22:06 
Hi all, I have meddled with threads in the past but I can't claim to really unerstand all the ins and outs of it. I'm stuck with a problem now and I'm hoping someone can point me in the right direction.

I have a custom control that's essentially a Panel onto which PictureBoxes can be placed at runtime. The important method in the class is public void AddImage(Image newImage) which creates a new PictureBox, calculates what the size of it should be, what the location of it should be etc. and then adds it to the panel.

So far so good. My problem is that this is a rather time consuming operation and in many cases I have a need to call this member several times in a row to add multiple images to my panel. I'd like to do all of this threaded so that:
1. the main form (containing the custom control) can be updated while images are being added to the control
2. the main form can still accept button clicks and what have you while images are being added to the control

I've tried using System.ComponentModel.BackgroundWorker and System.Threading.Thread but in both cases I've run into problems which might be too lengthy to explain here. I'm not looking for specific code but some advice on how threading can be used in this situation would be appreciated.

Some specific requirements that I have are:
1. I need for the pictures to be added to the control in the order in which I'm sending them with AddPicture.
2. I need to be abe to interrupt the sequence of calls to AddPicture at any stage so that the panel is cleared and a new sequence of calls to AddPicture is started.

Any ideas?
AnswerRe: Question on threads Pin
Nicholas Butler27-Sep-08 23:34
sitebuilderNicholas Butler27-Sep-08 23:34 
GeneralRe: Question on threads Pin
Dewald28-Sep-08 0:32
Dewald28-Sep-08 0:32 
GeneralRe: Question on threads Pin
Nicholas Butler28-Sep-08 1:34
sitebuilderNicholas Butler28-Sep-08 1:34 
GeneralRe: Question on threads Pin
Dewald28-Sep-08 3:57
Dewald28-Sep-08 3:57 
GeneralRe: Question on threads Pin
N a v a n e e t h28-Sep-08 8:01
N a v a n e e t h28-Sep-08 8:01 
GeneralRe: Question on threads Pin
Dewald28-Sep-08 10:15
Dewald28-Sep-08 10:15 
GeneralRe: Question on threads Pin
N a v a n e e t h28-Sep-08 17:17
N a v a n e e t h28-Sep-08 17:17 
GeneralRe: Question on threads Pin
Nicholas Butler29-Sep-08 0:41
sitebuilderNicholas Butler29-Sep-08 0:41 
GeneralRe: Question on threads Pin
Dewald29-Sep-08 1:08
Dewald29-Sep-08 1:08 
QuestionBianrySearch for IList<t></t> Pin
peterchen27-Sep-08 20:55
peterchen27-Sep-08 20:55 
AnswerRe: BianrySearch for IList Pin
N a v a n e e t h28-Sep-08 8:18
N a v a n e e t h28-Sep-08 8:18 
AnswerRe: BianrySearch for IList Pin
Lutosław28-Sep-08 11:44
Lutosław28-Sep-08 11:44 
QuestionProblem in showing exact data on reports(reguarding datetimepicker)??????? Pin
g_amol27-Sep-08 19:14
g_amol27-Sep-08 19:14 
Questionrelated path Pin
ahmed mega27-Sep-08 7:40
ahmed mega27-Sep-08 7:40 
AnswerRe: related path Pin
Pedram Behroozi27-Sep-08 8:19
Pedram Behroozi27-Sep-08 8:19 
QuestionPinvoke Pin
Miss_hacker27-Sep-08 3:08
Miss_hacker27-Sep-08 3:08 
AnswerRe: Pinvoke Pin
Giorgi Dalakishvili27-Sep-08 4:37
mentorGiorgi Dalakishvili27-Sep-08 4:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.