07-03-2010, 19:41
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..
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;
}
}