Simple and direct method to zoom the drawing to its extents is use the ActiveX API “ZoomExtents” as shown in below code.
VB.NET
C#
<CommandMethod("TestZoomExtent")> _
Public Sub TestZoomExtent()
'AcadApplication has a function to zoom extent
Dim acadApp As Object = Application.AcadApplication
acadApp.ZoomExtents()
End Sub
[CommandMethod("zoomExtentTest")]
public static void zoomExtentTest()
{
//using InvokeMember to support .NET 3.5
Object acadObject = Application.AcadApplication;
acadObject.GetType().InvokeMember("ZoomExtents",
BindingFlags.InvokeMethod, null, acadObject, null);
}