共用方式為


OrthographicCamera.Width 屬性

定義

取得或設定相機檢視方塊的寬度,以全局單位表示。

public:
 property double Width { double get(); void set(double value); };
public double Width { get; set; }
member this.Width : double with get, set
Public Property Width As Double

屬性值

Double

相機檢視方塊的寬度,以全局單位表示。

範例

下列範例會建立 並 OrthographicCamera 設定此屬性。

//Toggle between camera projections.
public void ToggleCamera(object sender, EventArgs e)
{
    if ((bool)CameraCheck.IsChecked == true)
    {
        OrthographicCamera myOCamera = new OrthographicCamera(new Point3D(0, 0, -3), new Vector3D(0, 0, 1), new Vector3D(0, 1, 0), 3);
        myViewport.Camera = myOCamera;
    }
    if ((bool)CameraCheck.IsChecked != true)
    {
        PerspectiveCamera myPCamera = new PerspectiveCamera(new Point3D(0, 0, -3), new Vector3D(0, 0, 1), new Vector3D(0, 1, 0), 50);
        myViewport.Camera = myPCamera;
    }
}
'Toggle between camera projections.
Public Sub ToggleCamera(ByVal sender As Object, ByVal e As EventArgs)
    If CBool(CameraCheck.IsChecked) = True Then
        Dim myOCamera As New OrthographicCamera(New Point3D(0, 0, -3), New Vector3D(0, 0, 1), New Vector3D(0, 1, 0), 3)
        myViewport.Camera = myOCamera
    End If
    If CBool(CameraCheck.IsChecked) <> True Then
        Dim myPCamera As New PerspectiveCamera(New Point3D(0, 0, -3), New Vector3D(0, 0, 1), New Vector3D(0, 1, 0), 50)
        myViewport.Camera = myPCamera
    End If
End Sub

備註

OrthographicCamera由於 描述不包含前景檢視方塊的投影,因此其檢視方塊具有平行側邊。 因此,檢視方塊的寬度可以使用單一值來指定。

下圖顯示正視線圖與透視對等相機投影之間的差異。

正視投影和透視投影

相依性屬性資訊

識別碼欄位 WidthProperty
設定為 的中繼資料屬性 true

適用於