вот функция C # для него
private void capture(Control ctrl, string fileName)
{
Rectangle bounds = ctrl.Bounds;
Point pt = ctrl.PointToScreen(bounds.Location);
Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height);
using (Graphics g = Graphics.FromImage(bitmap))
{
g.CopyFromScreen(new Point(pt.X - ctrl.Location.X, pt.Y - ctrl.Location.Y), Point.Empty, bounds.Size);
}
bitmap.Save(fileName,ImageFormat.Png);
}
и вызов
capture(chart1, @"c:\temp.png");
Вот вышеописанный метод c #, преобразованный в VB
Private Sub capture(ctrl As Control, fileName As String)
Dim bounds As Rectangle = ctrl.Bounds
Dim pt As Point = ctrl.PointToScreen(bounds.Location)
Dim bitmap As New Bitmap(bounds.Width, bounds.Height)
Using g As Graphics = Graphics.FromImage(bitmap)
g.CopyFromScreen(New Point(pt.X - ctrl.Location.X, pt.Y - ctrl.Location.Y), Point.Empty, bounds.Size)
End Using
bitmap.Save(fileName, ImageFormat.Png)
End Sub