469,898 Members | 2,201 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

Windows Forms - How Can I Make Them Draw/Render Properly?

Hello all. For a long time now I have been struggling with a .net
Windows Forms problem. In several of my applications, I use the
"Process" class from System.Diagnostics to accomplish various task
from within my code (kind of like the old VB shell function). Using
this process class appears to be just one example of what causes my
Windows forms to look really crazy when running the application. In
fact this has become not only a cosmetic issue but also a usability
issue as of late. Users are confused because the application is not
updating or appears to be not responding.

More specifically, when I say that the forms look crazy what I mean
is, that quite frequently:

* The forms will draw white and not update for several minutes.

* My application will have two or three windows open in the Windows
taskbar when there should only be one.

It's as if there is a lot of processing waiting to occur but it can't
for some reason (maybe because the app is tied up working with the
shelled processes?) Even then, though, it doesn't update between the
processes! It doesn't update between the processes, even though (in
despiration) I have included numerous calls to the form's "Activate",
"Show", and "Refresh" functions.

I am tired of this causing problems. I would really like to know what
I can do to prevent it from happening in the future. Somebody once
told me it had something to do with threading, but I don't know about
that. Does anyone have any suggestions on what I should do?
Nov 15 '05 #1
4 4617
Joey,

This is not a Windows Forms issue. Rather, this is probably an issue
about how you are instantiating the Process and calling Start on it. First,
the call should be on another thread, so that it does not interfere with the
responsiveness of the app. Second, how are you making the call?
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Joey Powell" <jo*********@goldcoinc.com> wrote in message
news:bd**************************@posting.google.c om...
Hello all. For a long time now I have been struggling with a .net
Windows Forms problem. In several of my applications, I use the
"Process" class from System.Diagnostics to accomplish various task
from within my code (kind of like the old VB shell function). Using
this process class appears to be just one example of what causes my
Windows forms to look really crazy when running the application. In
fact this has become not only a cosmetic issue but also a usability
issue as of late. Users are confused because the application is not
updating or appears to be not responding.

More specifically, when I say that the forms look crazy what I mean
is, that quite frequently:

* The forms will draw white and not update for several minutes.

* My application will have two or three windows open in the Windows
taskbar when there should only be one.

It's as if there is a lot of processing waiting to occur but it can't
for some reason (maybe because the app is tied up working with the
shelled processes?) Even then, though, it doesn't update between the
processes! It doesn't update between the processes, even though (in
despiration) I have included numerous calls to the form's "Activate",
"Show", and "Refresh" functions.

I am tired of this causing problems. I would really like to know what
I can do to prevent it from happening in the future. Somebody once
told me it had something to do with threading, but I don't know about
that. Does anyone have any suggestions on what I should do?

Nov 15 '05 #2
Nichlolas I am pretty sure that the processes are not on separate
threads...how does one do that anyway? You see, it's important that
app fire the processes syncronously - one can not run until the one
before it has finished...you know what I mean. That why I am using the
"Start" function along with the "WaitForExit" function of the process
class. I also call the "Dispose" function for each after I am
completely finished with the process. Now how can one accomplish the
syncronous processing while keeping the GUI updating properly?

"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote in message news:<Ok**************@TK2MSFTNGP09.phx.gbl>...
Joey,

This is not a Windows Forms issue. Rather, this is probably an issue
about how you are instantiating the Process and calling Start on it. First,
the call should be on another thread, so that it does not interfere with the
responsiveness of the app. Second, how are you making the call?
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Joey Powell" <jo*********@goldcoinc.com> wrote in message
news:bd**************************@posting.google.c om...
Hello all. For a long time now I have been struggling with a .net
Windows Forms problem. In several of my applications, I use the
"Process" class from System.Diagnostics to accomplish various task
from within my code (kind of like the old VB shell function). Using
this process class appears to be just one example of what causes my
Windows forms to look really crazy when running the application. In
fact this has become not only a cosmetic issue but also a usability
issue as of late. Users are confused because the application is not
updating or appears to be not responding.

More specifically, when I say that the forms look crazy what I mean
is, that quite frequently:

* The forms will draw white and not update for several minutes.

* My application will have two or three windows open in the Windows
taskbar when there should only be one.

It's as if there is a lot of processing waiting to occur but it can't
for some reason (maybe because the app is tied up working with the
shelled processes?) Even then, though, it doesn't update between the
processes! It doesn't update between the processes, even though (in
despiration) I have included numerous calls to the form's "Activate",
"Show", and "Refresh" functions.

I am tired of this causing problems. I would really like to know what
I can do to prevent it from happening in the future. Somebody once
told me it had something to do with threading, but I don't know about
that. Does anyone have any suggestions on what I should do?

Nov 15 '05 #3
That's what Nicolas was trying to say.
Because you call WaitForExit you're blocking the thread from updating the
GUI.
That's why you have to run these tasks on a different threads. Running it on
a different thread has nothing to do with accomplishing tasks in a specific
synchronious order. You can still do this, just on a different thread.

Greetz,
-- Rob.

Joey Powell wrote:
Nichlolas I am pretty sure that the processes are not on separate
threads...how does one do that anyway? You see, it's important that
app fire the processes syncronously - one can not run until the one
before it has finished...you know what I mean. That why I am using the
"Start" function along with the "WaitForExit" function of the process
class. I also call the "Dispose" function for each after I am
completely finished with the process. Now how can one accomplish the
syncronous processing while keeping the GUI updating properly?

"Nicholas Paldino [.NET/C# MVP]"
<ni**************@exisconsulting.com> wrote in message
news:<Ok**************@TK2MSFTNGP09.phx.gbl>...
Joey,

This is not a Windows Forms issue. Rather, this is probably an
issue
about how you are instantiating the Process and calling Start on it.
First,
the call should be on another thread, so that it does not interfere
with the
responsiveness of the app. Second, how are you making the call?
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Joey Powell" <jo*********@goldcoinc.com> wrote in message
news:bd**************************@posting.google.c om...
Hello all. For a long time now I have been struggling with a .net
Windows Forms problem. In several of my applications, I use the
"Process" class from System.Diagnostics to accomplish various task
from within my code (kind of like the old VB shell function). Using
this process class appears to be just one example of what causes my
Windows forms to look really crazy when running the application. In
fact this has become not only a cosmetic issue but also a usability
issue as of late. Users are confused because the application is not
updating or appears to be not responding.

More specifically, when I say that the forms look crazy what I mean
is, that quite frequently:

* The forms will draw white and not update for several minutes.

* My application will have two or three windows open in the Windows
taskbar when there should only be one.

It's as if there is a lot of processing waiting to occur but it
can't
for some reason (maybe because the app is tied up working with the
shelled processes?) Even then, though, it doesn't update between the
processes! It doesn't update between the processes, even though (in
despiration) I have included numerous calls to the form's
"Activate", "Show", and "Refresh" functions.

I am tired of this causing problems. I would really like to know
what
I can do to prevent it from happening in the future. Somebody once
told me it had something to do with threading, but I don't know
about
that. Does anyone have any suggestions on what I should do?

Nov 15 '05 #4
Have a look at my article on codeproject.com
http://www.codeproject.com/useritems/LaunchProcess.asp

and also this really good article on threading and UI's
http://msdn.microsoft.com/msdnmag/is...g/default.aspx
--
Mike Mayer
http://www.mag37.com/csharp/
mi**@mag37.com


"Rob Tillie" <Ro********@student.tul.edu> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
That's what Nicolas was trying to say.
Because you call WaitForExit you're blocking the thread from updating the
GUI.
That's why you have to run these tasks on a different threads. Running it on a different thread has nothing to do with accomplishing tasks in a specific synchronious order. You can still do this, just on a different thread.

Greetz,
-- Rob.

Joey Powell wrote:
Nichlolas I am pretty sure that the processes are not on separate
threads...how does one do that anyway? You see, it's important that
app fire the processes syncronously - one can not run until the one
before it has finished...you know what I mean. That why I am using the
"Start" function along with the "WaitForExit" function of the process
class. I also call the "Dispose" function for each after I am
completely finished with the process. Now how can one accomplish the
syncronous processing while keeping the GUI updating properly?

"Nicholas Paldino [.NET/C# MVP]"
<ni**************@exisconsulting.com> wrote in message
news:<Ok**************@TK2MSFTNGP09.phx.gbl>...
Joey,

This is not a Windows Forms issue. Rather, this is probably an
issue
about how you are instantiating the Process and calling Start on it.
First,
the call should be on another thread, so that it does not interfere
with the
responsiveness of the app. Second, how are you making the call?
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Joey Powell" <jo*********@goldcoinc.com> wrote in message
news:bd**************************@posting.google.c om...
Hello all. For a long time now I have been struggling with a .net
Windows Forms problem. In several of my applications, I use the
"Process" class from System.Diagnostics to accomplish various task
from within my code (kind of like the old VB shell function). Using
this process class appears to be just one example of what causes my
Windows forms to look really crazy when running the application. In
fact this has become not only a cosmetic issue but also a usability
issue as of late. Users are confused because the application is not
updating or appears to be not responding.

More specifically, when I say that the forms look crazy what I mean
is, that quite frequently:

* The forms will draw white and not update for several minutes.

* My application will have two or three windows open in the Windows
taskbar when there should only be one.

It's as if there is a lot of processing waiting to occur but it
can't
for some reason (maybe because the app is tied up working with the
shelled processes?) Even then, though, it doesn't update between the
processes! It doesn't update between the processes, even though (in
despiration) I have included numerous calls to the form's
"Activate", "Show", and "Refresh" functions.

I am tired of this causing problems. I would really like to know
what
I can do to prevent it from happening in the future. Somebody once
told me it had something to do with threading, but I don't know
about
that. Does anyone have any suggestions on what I should do?


Nov 15 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Jan Kopcsek | last post: by
4 posts views Thread by Coskun Cavusoglu | last post: by
4 posts views Thread by Joe Kasta | last post: by
4 posts views Thread by Rod Gill | last post: by
6 posts views Thread by Nathan Laff | last post: by
6 posts views Thread by Chris Marsh | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.