在WPF中可以做出旋转的界面,这样不仅效果好看,而且节省界面和代码处理。
xaml代码如下:
<Window x:Class="V3ViewApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Title="旋转界面" Height="360" Width="450" Background="Black" WindowState="Normal" WindowStartupLocation="CenterScreen">
<Window.Resources>
<sys:Double x:Key="grdSize">200</sys:Double>
</Window.Resources>
<Grid >
<Viewport3D ClipToBounds="True" HorizontalAlignment="Center" VerticalAlignment="Center" Height="500" Width="500">
<Viewport3D.Camera>
<PerspectiveCamera LookDirection="0,0,-1" Position="0,0,300"/>
</Viewport3D.Camera>
<Viewport3D.Children>
<ModelVisual3D>
<ModelVisual3D.Content>
<AmbientLight Color="Transparent"/>
</ModelVisual3D.Content>
<ModelVisual3D.Children>
<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>
<Viewport2DVi