1、播放音乐添加进入声音时,要将音频时间置零。音频格式最好是 MP3 格式的。页面代码:后台代码:using System;using System.Windows.Controls;using System.Windows.Input;namespace MusicAndMoviepublic partial class MainPage : UserControlpublic MainPage()InitializeComponent();private void btnGuess_MouseEnter(object sender, MouseEventArgs e)TimeSpan time
2、=new TimeSpan ();MusicTwo.Position = time;MusicTwo.Play();btnGuess.Content = “You Can Try Me !“;private void btnGuess_MouseLeave(object sender, MouseEventArgs e)TimeSpan time = new TimeSpan();MusicOne.Position = time;MusicOne.Play();btnGuess.Content = “Baybay!“;播放视频注意:设置资源后,将Web重新生成一下。AutoPlay应置为Fal
3、se页面代码:后台代码:using System.Windows;using System.Windows.Controls;using System.Windows.Input;namespace Floatpublic partial class MainPage : UserControlbool isplay = true;public MainPage()InitializeComponent();private void btnStart_Click(object sender, RoutedEventArgs e)if (isplay)btnStart.Content = “暂停“;mv01.Play();isplay = false;elsebtnStart.Content = “播放“;mv01.Pause();isplay = true;private void btnStart_MouseEnter(object sender, MouseEventArgs e)/添加鼠标进入效果、函数private void btnStart_MouseLeave(object sender, MouseEventArgs e)