For my Windows CE 5.0 App (using C# in Visual Studio 2005) I have to create several images (on the fly) and play them back as an animation. I've created an "Animation Control" which holds an array of images (usually about 18 images) and uses a timer to show them via "DrawImage". This control loops through the array of images on each counter tick per the following: private void timerAnimation_Tick(object sender, EventArgs e) { if (animationImages.Length <= 0) // no images in the array return; if (++nCurrentImageRef >= animationImages.Length) nCurrentImageRef = 0; // draw the current image // gControl is the Graphics object for this control gControl.DrawImage(animationImages[nCurrentImageRef], ClientRectangle.Left, ClientRectangle.Top); } My problem is that this animation runs smoothly for a couple hundred timer ticks, pauses for a few seconds and then continues where it left off. These pauses are typically for 3 or 4 seconds and they occur somewhat randomly. Is this due to garbage collection or due to my "DrawImage" approach? I've used other timers in this application (just to test what's going on) and they don't experience these same "pauses" - just this one. Thanks.
It's highly likely to be a GC issue, though RPM would tell you for certain (and quite quickly). We don't see enough of your code to know where any GC issues might lie though. -Chris "mcm" wrote in message news:e6%23slbT4IHA.1192@TK2MSFTNGP05.phx.gbl... > For my Windows CE 5.0 App (using C# in Visual Studio 2005) I have to > create several images (on the fly) and play them back as an animation. > > I've created an "Animation Control" which holds an array of images > (usually about 18 images) and uses a timer to show them via "DrawImage". > This control loops through the array of images on each counter tick per > the following: > > private void timerAnimation_Tick(object sender, EventArgs e) > { > if (animationImages.Length <= 0) // no images in the array > return; > if (++nCurrentImageRef >= animationImages.Length) > nCurrentImageRef = 0; > > // draw the current image > // gControl is the Graphics object for this control > gControl.DrawImage(animationImages[nCurrentImageRef], > ClientRectangle.Left, ClientRectangle.Top); > > } > > My problem is that this animation runs smoothly for a couple hundred timer > ticks, pauses for a few seconds and then continues where it left off. > These pauses are typically for 3 or 4 seconds and they occur somewhat > randomly. Is this due to garbage collection or due to my "DrawImage" > approach? > > I've used other timers in this application (just to test what's going on) > and they don't experience these same "pauses" - just this one. > > Thanks. > >