Re: A question on threading

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.
.



Relevant Pages

  • Re: Canvas extension: point item?
    ... Here's basically what you do to create a color bitmap and control the ... create a new image of type photo ... put it your GUI ... If you can draw your pixels sequentially, the scanline method is the way to ...
    (comp.lang.tcl)
  • Re: Working with images
    ... I´m using some images on a GUI, ... fixed measurement, is it possible?. ... have different image objects laying around for the Bitmap. ...
    (comp.lang.prolog)
  • Re: A question on threading
    ... Do you send some kind of data to the gui that does some drawings related work on the gui ?? ... 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. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: So what is vector based graphics?
    ... Is this more efficient for a GUI to do it this way? ... computational power than a bitmap texture based GUI? ...
    (microsoft.public.win32.programmer.directx.graphics)
  • How To Transform Color?
    ... I have a bitmap file that I use as part of a skin in my GUI. ... the R,G,B values of the foreground color. ...
    (comp.graphics.algorithms)