WPF_Viewport3D_一个简洁规整的例子(Z)

  <Viewport3D ClipToBounds="True" HorizontalAlignment="Center" VerticalAlignment="Center" Height="500" Width="500">
            <Viewport3D.Camera>
                <PerspectiveCamera LookDirection="0,-1,-3" Position="0,200,300"/>
            </Viewport3D.Camera>
            <Viewport3D.Children>
                <ModelVisual3D>
                    <ModelVisual3D.Content>
                        <AmbientLight Color="Transparent"/>
                    </ModelVisual3D.Content>
                    <ModelVisual3D.Children>
                        <!--Top-->
                        <Viewport2DVisual3D>
                            <Viewport2DVisual3D.Geometry>
                                <MeshGeometry3D Positions="-50,50,-50  -50,50,50  50,50,50  50,50,-50"
                                                Normals="0,0,1  0,0,1  0,0,1  0,0,1"
                                                TriangleIndices="0,1,2  0,2,3"
                                                TextureCoordinates="0,0  0,1  1,1  1,0"/>
                            </Viewport2DVisual3D.Geometry>
                            <Viewport2DVisual3D.Material>
                                <DiffuseMaterial Brush="Transparent" Viewport2DVisual3D.IsVisualHostMaterial="True"/>
                            </Viewport2DVisual3D.Material>
                            <Viewport2DVisual3D.Visual>
                                <!--<Grid Background="LightGray"  Width="{StaticResource grdSize}" Height="{StaticResource grdSize}">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="auto"/>
                                        <RowDefinition Height="*"/>
                                        <RowDefinition Height="auto"/>
                                    </Grid.RowDefinitions>
                                    <TextBlock FontWeight="Bold" Text="修改密码" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,2,0,1"/>
                                    <StackPanel Grid.Row="1" Orientation="Vertical" Margin="5">
                                        <TextBlock Text="旧密码:"/>
                                        <PasswordBox />
                                        <TextBlock Margin="0,10,0,0" Text="新密码:"/>
                                        <PasswordBox/>
                                        <TextBlock Margin="0,10,0,0" Text="确认密码:"/>
                                        <PasswordBox/>
                                    </StackPanel>
                                    <StackPanel Grid.Row="2" Margin="0,3,0,4" Orientation="Horizontal" HorizontalAlignment="Center">
                                        <Button Content="确定" Padding="3,2"/>
                                        <Button Content="取消" Padding="3,2"/>
                                    </StackPanel>
                                </Grid>-->
                                <Ellipse Width="{StaticResource grdSize}" Height="{StaticResource grdSize}" Fill="AliceBlue"></Ellipse>
                            </Viewport2DVisual3D.Visual>
                        </Viewport2DVisual3D>
                        <!-- 第一个视图 --><!--
                        <Viewport2DVisual3D>
                            <Viewport2DVisual3D.Geometry>
                                <MeshGeometry3D Positions="-50,50,-50  -50,-50,-50  -50,-50,50  -50,50,50"
                                                Normals="0,0,1  0,0,1  0,0,1  0,0,1"
                                                TriangleIndices="0,1,2  0,2,3"
                                                TextureCoordinates="0,0  0,1  1,1  1,0"/>
                            </Viewport2DVisual3D.Geometry>
                            <Viewport2DVisual3D.Material>
                                <DiffuseMaterial Brush="Transparent" Viewport2DVisual3D.IsVisualHostMaterial="True"/>
                            </Viewport2DVisual3D.Material>
                            <Viewport2DVisual3D.Visual>
                                <Grid Background="LightGray"  Width="{StaticResource grdSize}" Height="{StaticResource grdSize}">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="auto"/>
                                        <RowDefinition Height="*"/>
                                        <RowDefinition Height="auto"/>
                                    </Grid.RowDefinitions>
                                    <TextBlock FontWeight="Bold" Text="修改密码" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,2,0,1"/>
                                    <StackPanel Grid.Row="1" Orientation="Vertical" Margin="5">
                                        <TextBlock Text="旧密码:"/>
                                        <PasswordBox />
                                        <TextBlock Margin="0,10,0,0" Text="新密码:"/>
                                        <PasswordBox/>
                                        <TextBlock Margin="0,10,0,0" Text="确认密码:"/>
                                        <PasswordBox/>
                                    </StackPanel>
                                    <StackPanel Grid.Row="2" Margin="0,3,0,4" Orientation="Horizontal" HorizontalAlignment="Center">
                                        <Button Content="确定" Padding="3,2"/>
                                        <Button Content="取消" Padding="3,2"/>
                                    </StackPanel>
                                </Grid>
                            </Viewport2DVisual3D.Visual>
                        </Viewport2DVisual3D>
                        --><!-- 第二个视图 --><!--
                        <Viewport2DVisual3D>
                            <Viewport2DVisual3D.Geometry>
                                <MeshGeometry3D Positions="-50,50,50  -50,-50,50  50,-50,50  50,50,50"
                                                Normals="0,0,1  0,0,1  0,0,1  0,0,1"
                                                TriangleIndices="0,1,2  0,2,3"
                                                TextureCoordinates="0,0  0,1  1,1  1,0"/>
                            </Viewport2DVisual3D.Geometry>
                            <Viewport2DVisual3D.Material>
                                <DiffuseMaterial Brush="Transparent" Viewport2DVisual3D.IsVisualHostMaterial="True"/>
                            </Viewport2DVisual3D.Material>
                            <Viewport2DVisual3D.Visual>
                                <Grid Background="YellowGreen" Height="{StaticResource grdSize}" Width="{StaticResource grdSize}">
                                    <StackPanel Margin="4">
                                        <TextBlock Text="请选择每次发送消息数:"/>
                                        <StackPanel Margin="1,2">
                                            <RadioButton Content="3条"/>
                                            <RadioButton Content="5条"/>
                                            <RadioButton Content="8条"/>
                                            <RadioButton Content="15条"/>
                                        </StackPanel>
                                    </StackPanel>
                                </Grid>
                            </Viewport2DVisual3D.Visual>
                        </Viewport2DVisual3D>
                        --><!-- 第三个视图 --><!--
                        <Viewport2DVisual3D>
                            <Viewport2DVisual3D.Geometry>
                                <MeshGeometry3D Positions="50,50,50  50,-50,50  50,-50,-50  50,50,-50"
                                                Normals="0,0,1  0,0,1  0,0,1  0,0,1"
                                                TriangleIndices="0,1,2  0,2,3"
                                                TextureCoordinates="0,0  0,1  1,1  1,0"/>
                            </Viewport2DVisual3D.Geometry>
                            <Viewport2DVisual3D.Material>
                                <DiffuseMaterial Brush="Transparent" Viewport2DVisual3D.IsVisualHostMaterial="True"/>
                            </Viewport2DVisual3D.Material>
                            <Viewport2DVisual3D.Visual>
                                <Grid Background="LightGreen" Width="{StaticResource grdSize}" Height="{StaticResource grdSize}">
                                    <Canvas>
                                        <Rectangle Canvas.Top="12" Canvas.Left="34" Fill="Red" Width="30" Height="30"/>
                                        <Rectangle Fill="Blue" Canvas.Top="60" Canvas.Left="32" Width="35" Height="35"/>
                                    </Canvas>
                                </Grid>
                            </Viewport2DVisual3D.Visual>
                        </Viewport2DVisual3D>
                        --><!-- 第四个视图 --><!--
                        <Viewport2DVisual3D>
                            <Viewport2DVisual3D.Geometry>
                                <MeshGeometry3D Positions="50,50,-50  50,-50,-50  -50,-50,-50  -50,50,-50"
                                                Normals="0,0,1  0,0,1  0,0,1  0,0,1"
                                                TriangleIndices="0,1,2  0,2,3"
                                                TextureCoordinates="0,0  0,1  1,1  1,0"/>
                            </Viewport2DVisual3D.Geometry>
                            <Viewport2DVisual3D.Material>
                                <DiffuseMaterial Brush="Transparent" Viewport2DVisual3D.IsVisualHostMaterial="True"/>
                            </Viewport2DVisual3D.Material>
                            <Viewport2DVisual3D.Visual>
                                <Grid Background="LightBlue" Height="{StaticResource grdSize}" Width="{StaticResource grdSize}">
                                    <StackPanel Margin="6">
                                        <CheckBox Content="同时下载临时数据"/>
                                        <CheckBox Content="自动备份数据"/>
                                        <CheckBox Content="压缩流"/>
                                        <StackPanel Margin="0,3,0,0" Orientation="Horizontal">
                                            <TextBlock Text="端口:" VerticalAlignment="Center"/>
                                            <TextBox Width="60" Text="1379"/>
                                        </StackPanel>
                                    </StackPanel>
                                </Grid>
                            </Viewport2DVisual3D.Visual>
                        </Viewport2DVisual3D>-->
                    </ModelVisual3D.Children>
                    <ModelVisual3D.Transform>
                        <RotateTransform3D  CenterX="0" CenterY="0" CenterZ="0">
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D Angle="0" Axis="0,1,0" x:Name="ar"/> 
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                    </ModelVisual3D.Transform>
                </ModelVisual3D>
            </Viewport3D.Children>
        </Viewport3D>

 

posted @ 2017-03-07 17:40  过客非归  阅读(2911)  评论(0编辑  收藏  举报