ajhvdb
Junior Member
 
Posts: 12
Joined: Mar 2010
|
Slide animator uses a lot of memory
Maybe it's anothere library i'm using but I can go to other forms from my home form 8 or 9 times and then I get exceptions like "out of memory".
Is there anything wrong with the code i'm using? I need to do it this way because the touchlistbox doesn't slide away. The background slide beneath it.
To speed things up, I created 2 bitmaps before using this function..
Code:
private void StartForm(Form Frm)
{
SlideAnimator tSlideAnimator;
Graphics tGraphicsBuffer;
tGraphicsBuffer = this.CreateGraphics();
tSlideAnimator = new SlideAnimator(_bmImageOne, _bmImageTwo, tGraphicsBuffer);
tSlideAnimator.BackgroundColor = System.Drawing.Color.Red;
if (!_StopAnimation)
{
try
{
tlbMenu.Visible = false; //Hide, because the Animation doesn't move it
tSlideAnimator.Animate(SlideAnimator.SlideDirection.sdLeft);
Frm.ShowDialog();
Frm.Dispose();
}
catch
{
_StopAnimation = true;
}
}
if (!_StopAnimation)
{
try
{
tSlideAnimator = new SlideAnimator(_bmImageTwo, _bmImageOne, tGraphicsBuffer);
tSlideAnimator.Animate(SlideAnimator.SlideDirection.sdRight);
}
catch
{
_StopAnimation = true;
}
}
tGraphicsBuffer.Dispose();
if (!tlbMenu.Visible) //Show again
{
tlbMenu.Visible = true;
}
}
|
|
| 07-03-2010 19:41 |
|
ajhvdb
Junior Member
 
Posts: 12
Joined: Mar 2010
|
RE: Slide animator uses a lot of memory
(23-03-2010 12:33)Sascha Lange Wrote: You have to Dispose() _bmImageOne and _bmImageTwo. Otherwise it will be still stored in memory.
These are local vars.
I need to use bitmap.dispose(); ?
|
|
| 23-03-2010 13:11 |
|