请单击以进行评分并提供反馈

  开启低带宽视图
.NET Framework 类库
ModelUIElement3D 类

更新:2007 年 11 月

呈现支持输入、焦点和事件的三维模型。

命名空间:  System.Windows.Media.Media3D
程序集:  PresentationCore(在 PresentationCore.dll 中)
用于 XAML 的 XMLNS:http://schemas.microsoft.com/winfx/xaml/presentation

Visual Basic(声明)
<ContentPropertyAttribute("Model")> _
Public NotInheritable Class ModelUIElement3D _
    Inherits UIElement3D
Visual Basic (用法)
Dim instance As ModelUIElement3D
C#
[ContentPropertyAttribute("Model")]
public sealed class ModelUIElement3D : UIElement3D
Visual C++
[ContentPropertyAttribute(L"Model")]
public ref class ModelUIElement3D sealed : public UIElement3D
J#
/** @attribute ContentPropertyAttribute("Model") */
public final class ModelUIElement3D extends UIElement3D
JScript
public final class ModelUIElement3D extends UIElement3D
XAML 对象元素用法
<ModelUIElement3D>
  Model
</ModelUIElement3D>

.NET Framework 3.5 版中引入了 ModelUIElement3D。有关更多信息,请参见 .NET Framework 3.5 体系结构

下面的示例演示如何使用 ModelUIElement3D 类创建两个多维数据集:

C#
<Viewport3D>
    <Viewport3D.Camera>
        <PerspectiveCamera Position="8,3,0" LookDirection="-8,-3,0" />
    </Viewport3D.Camera>

    <!-- The container has the two cubes as its children -->
    <ContainerUIElement3D MouseDown="ContainerMouseDown">
        <ContainerUIElement3D.Transform>
            <RotateTransform3D>
                <RotateTransform3D.Rotation>
                    <AxisAngleRotation3D x:Name="containerRotation" Axis="0, 1, 0" Angle="0" />
                </RotateTransform3D.Rotation>
            </RotateTransform3D>
        </ContainerUIElement3D.Transform>

        <!-- Cube 1 -->
        <ModelUIElement3D MouseDown="Cube1MouseDown">
            <ModelUIElement3D.Transform>
                <TranslateTransform3D OffsetZ="1.5" />
            </ModelUIElement3D.Transform>

            <ModelUIElement3D.Model>
                <GeometryModel3D Geometry="{StaticResource CubeMesh}">
                    <GeometryModel3D.Material>
                        <DiffuseMaterial x:Name="cube1Material" Brush="Blue" />
                    </GeometryModel3D.Material>
                </GeometryModel3D>
            </ModelUIElement3D.Model>
        </ModelUIElement3D>

        <!-- Cube 2 -->
        <ModelUIElement3D MouseDown="Cube2MouseDown">
            <ModelUIElement3D.Transform>
                <TranslateTransform3D OffsetZ="-1.5" />
            </ModelUIElement3D.Transform>

            <ModelUIElement3D.Model>
                <GeometryModel3D Geometry="{StaticResource CubeMesh}">
                    <GeometryModel3D.Material>
                        <DiffuseMaterial x:Name="cube2Material" Brush="Green" />
                    </GeometryModel3D.Material>
                </GeometryModel3D>
            </ModelUIElement3D.Model>
        </ModelUIElement3D>                
    </ContainerUIElement3D>

    <!-- Lights -->
    <ModelVisual3D>
        <ModelVisual3D.Content>
            <PointLight Color="White" Position="3, 10, 4" />
        </ModelVisual3D.Content>
    </ModelVisual3D>
</Viewport3D>


多维数据集通过下面的事件处理程序来响应鼠标按下事件:

有关完整示例,请参见处理三维事件的示例

此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

.NET Framework

受以下版本支持:3.5 SP1、3.0 SP1
社区内容   什么是社区内容?
添加新内容 RSS  批注
Processing
© 2009 Microsoft Corporation 版权所有。 保留所有权利  |  商标  |  隐私权声明
Page view tracker