Sign in to follow this  
Muzzy A

C# stop waiting on events

Recommended Posts

Muzzy A    737
Im using C# to start on a Particle Editor for school, but I forgot how to stop waiting on events.

I know you at least need to do this, which i've done, but i can't remember what else I was supposed to do somewhere else. Anyone else know?
[code]
// Inherit from Panel
class graphics_panel : Panel
{
public graphics_panel()
{
DoubleBuffered = true;
}
}
[/code] Edited by Muzzy A

Share this post


Link to post
Share on other sites
Narf the Mouse    322
[quote name='Muzzy A' timestamp='1339313511' post='4947844']
Im using C# to start on a Particle Editor for school, but I forgot how to stop waiting on events.

I know you at least need to do this, which i've done, but i can't remember what else I was supposed to do somewhere else. Anyone else know?
[code]
// Inherit from Panel
class graphics_panel : Panel
{
public graphics_panel()
{
DoubleBuffered = true;
}
}
[/code]
[/quote]
Check the value of DoubleBuffered, and if it's true, start the relevant code, is what comes to mind.

Share this post


Link to post
Share on other sites
Muzzy A    737
well by default c# waits on an event to happen like "GetMessage()" in Windows. I want it to run like "PeekMessage". I just don't remember where to change that, i know it wasn't that buffer check though. Thanks anyways =)

Share this post


Link to post
Share on other sites
Narf the Mouse    322
[quote name='Muzzy A' timestamp='1339327764' post='4947886']
well by default c# waits on an event to happen like "GetMessage()" in Windows. I want it to run like "PeekMessage". I just don't remember where to change that, i know it wasn't that buffer check though. Thanks anyways =)
[/quote]
Ah - You're probably looking for an EventHandler, then.

Share this post


Link to post
Share on other sites
laztrezort    1058
I believe what you are looking to do is discussed here: [url="http://blogs.msdn.com/b/shawnhar/archive/2010/12/06/when-winforms-met-game-loop.aspx"]http://blogs.msdn.com/b/shawnhar/archive/2010/12/06/when-winforms-met-game-loop.aspx[/url]

It's targeted for XNA + Winforms, but should be applicable in straight Winforms applications that need animation timing as well.

Share this post


Link to post
Share on other sites
DvDmanDT    1941
There are several ways to do what you want. In order to not wait for messages at all, you must change Application.Run(new YourForm()); in Program.cs (default location of that line). An easier solution would be to just add a timer and call Refresh() or yourPanel.Refresh() on its Tick event.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this