By Adam Nagy
I have an Autodesk.Navisworks.Api.Controls.ViewControl in my .NET application and would like to create a snapshot of the current view and save it to a bitmap.
Solution
You could simply use the .NET Framework to achieve that.
private void buttonSnapShot_Click(object sender, EventArgs e)
{
Bitmap bmp = new Bitmap(
viewControl.Bounds.Width, viewControl.Bounds.Height);
Graphics graphics = Graphics.FromImage(bmp);
// If you are stepping through the code and the debugger
// (or anything else) is in front of the ViewControl,
// then that will be captured instead
graphics.CopyFromScreen(
viewControl.PointToScreen(new Point(0, 0)),
new Point(0, 0),
new Size(bmp.Width, bmp.Height));
bmp.Save("c:\\test.bmp");
}