ビューの尺度を変更する(.NET)

図面ウィンドウでイメージの表示倍率を変更する必要がある場合は、現在のビューのWidth および Height プロパティを変更します。ビューのサイズを変更する場合は、必ず同じ係数で Width と Height プロパティを変更します。現在のビューのサイズを変更する場合、一般的には、次のいずれかに基づいて尺度係数が計算されます。

指定された倍率を使用してアクティブな図面をズームする

このサンプル コードは、「現在のビューを操作する」トピックで定義されているズーム関数を使用して、現在のビューを 50% 縮小する方法を示しています。

ズーム関数に合計 4 つの値が渡されますが、最初の 2 つは使用されていない新しい 3D 点です。渡される 3 番目の値はビューのサイズ変更で使用される中心点であり、渡される最後の値はビューのサイズ変更で使用される尺度係数です。

C# の例

[CommandMethod("ZoomScale")]
static public void ZoomScale()
{
    // Get the current document
    Document acDoc = Application.DocumentManager.MdiActiveDocument;
 
    // Get the current view
    using (ViewTableRecord acView = acDoc.Editor.GetCurrentView())
    {
        // Get the center of the current view
        Point3d pCenter = new Point3d(acView.CenterPoint.X,
                                      acView.CenterPoint.Y, 0);
 
        // Set the scale factor to use
        double dScale = 0.5;
 
        // Scale the view using the center of the current view
        Zoom(new Point3d(), new Point3d(), pCenter, 1 / dScale);
    }
}