Re: A question on threading
- From: Rahul <rahuldj@xxxxxxxxx>
- Date: Sun, 2 Mar 2008 18:44:29 -0800 (PST)
On Mar 2, 6:19 am, "Abubakar" <invalidem...@xxxxxxxxxxxxxxxx> wrote:
Hi,
refresh to display the changes in image during processing.
what kind of changes? Do you send some kind of data to the gui that does
some drawings related work on the gui ??
among other things, calls this.Invalidate(); to make the screen
i dont do much gui programming, but if I look in the msdn and see the help
for Invalidate() method of Control class, it says this method causes paint
message to be sent to the control, calling which made sense when u were
executing the compression code inside the gui thread. But now that you
managed to run the compression code inside another thread, why would you
want to do something to send the paint message in the gui so it could
refresh, bcuz I think it would now be refreshing on its own whenever the
need is to do so.
I may have some suggestions but it depends on your answers to the questions
above.
..ab
"Rahul" <rahu...@xxxxxxxxx> wrote in message
news:00d8eb3f-a115-4527-8052-1dc6139b5ab3@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,
I am writing a program related to image compression in C# (GUI
Application). In that I have a "heavy, long running" method which
among other things, calls this.Invalidate(); to make the screen
refresh to display the changes in image during processing.
The problem is that, once the program enters this method, the GUI
Window becomes non-responsive (but GUI gets updated regularly due to
this.Invalidate()).
So, I want the GUI to stay responsive while executing this method.
I tried running the method in another thread but then I cannot call
this.Invalidate() because "this" is in parent thread, and it throws
error.
How can I keep my window responsive while running this method? Any
ideas?
@Abubakar,
My code actually modifies the bitmap that I'm going to display. This
bitmap contains the pixel information of the compressed output image.
Since the bitmap is a data structure, there is no event associated
with it that can trigger a GUI update.
So I am explicitly telling the window that "I have modified the
bitmap, please render it" using this.Invalidate(); + this.Update()
I hope this clarifies my approach in rendering the image. I am a
student and not especially skilled in this language so please guide me
if I'm doing this the wrong way. I'm trying to implement the JPEG
compression scheme (just for fun... hoping to learn something while at
it.)
I appreciate you taking time to help me out.
.
- References:
- A question on threading
- From: Rahul
- Re: A question on threading
- From: Abubakar
- A question on threading
- Prev by Date: Re: Parsing in between strings using Regex
- Next by Date: Re: EventArgs and derived classes
- Previous by thread: Re: A question on threading
- Next by thread: Alternative to static property in interface?
- Index(es):
Relevant Pages
|