G
Guest
Hi!
I want to create an appealing user interface by using transitions when
passing form a form to another. For instance, I want to create an ipod-like
effect, where forms are appearing by sliding from the right side of the
screen.
In order to do it, I though the best way would be to capture the form to
appear into a Bitmap, and then animate that bitmap from right to left.
I have used a sample from MSDN to capture the form to a Bitmap
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/scibf.asp
The problem is that the captured bitmap does not contain the form. Controls
on top of the form are not painted, and appear as empty rectangles.
Do you know how it is possible to paint a form (including all the controls
into that form) into a Bitmap object?
The challenge here, is that the form to capture is not currently displayed.
Your help will be really appreciated!
Thanks a lot!
This is the code for the form to appear with a right-left transition:
protected override void OnPaint(PaintEventArgs e)
{
if (animate)
{
Bitmap bmp = BitmapFile.CaptureControl(this, 24,
this.Bounds.Width, this.Bounds.Height);
Graphics graphics = this.CreateGraphics();
for (int i = this.Bounds.Width; i > 0; i = i - 1)
{
graphics.DrawImage(bmp, i, 0);
Thread.Sleep(10);
}
bmp.Dispose();
animate = false;
this.Refresh();
}
else
{
base.OnPaint(e);
}
}
I want to create an appealing user interface by using transitions when
passing form a form to another. For instance, I want to create an ipod-like
effect, where forms are appearing by sliding from the right side of the
screen.
In order to do it, I though the best way would be to capture the form to
appear into a Bitmap, and then animate that bitmap from right to left.
I have used a sample from MSDN to capture the form to a Bitmap
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/scibf.asp
The problem is that the captured bitmap does not contain the form. Controls
on top of the form are not painted, and appear as empty rectangles.
Do you know how it is possible to paint a form (including all the controls
into that form) into a Bitmap object?
The challenge here, is that the form to capture is not currently displayed.
Your help will be really appreciated!
Thanks a lot!
This is the code for the form to appear with a right-left transition:
protected override void OnPaint(PaintEventArgs e)
{
if (animate)
{
Bitmap bmp = BitmapFile.CaptureControl(this, 24,
this.Bounds.Width, this.Bounds.Height);
Graphics graphics = this.CreateGraphics();
for (int i = this.Bounds.Width; i > 0; i = i - 1)
{
graphics.DrawImage(bmp, i, 0);
Thread.Sleep(10);
}
bmp.Dispose();
animate = false;
this.Refresh();
}
else
{
base.OnPaint(e);
}
}