Re: form object
- From: "Marc Gravell" <marc.gravell@xxxxxxxxx>
- Date: Tue, 6 Jun 2006 08:56:59 +0100
Two observations:
1: any static method should probably be thread-aware; when dealing with
forms, this means that it should probably test currentForm.InvokeRequired
and (if true) push the method onto the owning UI's thread; I'm pretty sure
(not 100%) that Opacity has thread affinity..
2: while(z<10000) {z++;}
I don't mean to be rude - just frank; this is quite possibly the worst way
of putting a delay into code:
* It will run at different speeds on different computers
* it might even get completely removed by an optimizing compiler (typically
only in release mode)
You don't want to Sleep(), as this will hang the UI thread (unless you spin
up a second thread that alternates between Sleep() [on its own thread] and
BeginInvoke() [on the form]); a timer would be the normal implementation?
Marc
.
- Follow-Ups:
- Re: form object
- From: Marc Gravell
- Re: form object
- Prev by Date: Pocket PC: Adding an additional toolbar
- Next by Date: Re: operator+=
- Previous by thread: Re: form object
- Next by thread: Re: form object
- Index(es):
Relevant Pages
|
Loading