查看Demo
另外,还可以将 Matrix3DProjection 和 Matrix3D 类型用于比使用 PlaneProjection 可能更复杂的准三维方案。
示例代码:沿Y轴翻转:
XAML:
< Image Grid.Row ="1" Height ="147" HorizontalAlignment ="Left" Margin ="52,28,0" Name ="image1" Stretch ="Fill" VerticalAlignment ="Top" Width ="220" Source ="/SilverlightApplication1;component/images/61e44a60jw1dglvwijv8nj.jpg" > < Image.Projection > < PlaneProjection x:Name ="ppFlipImage" ></ PlaneProjection > </ Image.Projection > </ Image > < Button Content ="Button" Grid.Row ="1" Height ="23" HorizontalAlignment ="Left" Margin ="125,182,0" Name ="button1" VerticalAlignment ="Top" Width ="75" Click ="button1_Click" />
C#:
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using System.Windows.Threading; namespace SilverlightApplication1 { public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); this .LayoutRoot.Loaded += new RoutedEventHandler(LayoutRoot_Loaded); } void LayoutRoot_Loaded( object sender,RoutedEventArgs e) { tmrY = new dispatcherTimer(); tmrY.Tick += tmrY_Tick; TimeSpan tsFlip = new TimeSpan( 0 , 0 ,frequence); // 100 Milliseconds tmrY.Interval = tsFlip; } private int frequence = 10 ; private dispatcherTimer tmrY; private void button1_Click( object sender,RoutedEventArgs e) { // this.ppFlipImage.RotationY = (this.ppFlipImage.RotationY + 1) % 360; if ( ! tmrY.IsEnabled) { tmrY.Start(); } else { tmrY.Stop(); } } void tmrY_Tick( object sender,EventArgs e) { this .ppFlipImage.RotationY = ( this .ppFlipImage.RotationY + 1 ) % 360 ; } } }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。