如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
播放音乐添加进入声音时,要将音频时间置零。音频格式最好是MP3格式的。页面代码:<UserControlx:Class="MusicAndMovie.MainPage"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"mc:Ignorable="d"d:DesignHeight="400"d:DesignWidth="500"><Canvasx:Name="CanvasOne"Width="500"Height="400"><MediaElementx:Name="MusicOne"Source="Sound/Start.mp3"AutoPlay="True"></MediaElement><MediaElementx:Name="MusicTwo"Source="Sound/click.mp3"AutoPlay="False"></MediaElement><ButtonName="btnGuess"Width="105"Height="40"Canvas.Left="324"Canvas.Top="291"Content="YouCanTryMe!"MouseEnter="btnGuess_MouseEnter"MouseLeave="btnGuess_MouseLeave"></Button></Canvas></UserControl>后台代码:usingSystem;usingSystem.Windows.Controls;usingSystem.Windows.Input;namespaceMusicAndMovie{publicpartialclassMainPage:UserControl{publicMainPage(){InitializeComponent();}privatevoidbtnGuess_MouseEnter(objectsender,MouseEventArgse){TimeSpantime=newTimeSpan();MusicTwo.Position=time;MusicTwo.Play();btnGuess.Content="YouCanTryMe!";}privatevoidbtnGuess_MouseLeave(objectsender,MouseEventArgse){TimeSpantime=newTimeSpan();MusicOne.Position=time;MusicOne.Play();btnGuess.Content="Baybay!";}}}播放视频注意:设置资源后,将Web重新生成一下。AutoPlay应置为False页面代码:<UserControlx:Class="Float.MainPage"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"mc:Ignorable="d"d:DesignHeight="300"d:DesignWidth="400"><Gridx:Name="LayoutRoot"Background="White"><MediaElementSource="TEB4ES_P01_C06_L01.wmv"AutoPlay="False"Width="800"Height="600"Name="mv01"></MediaElement><ButtonName="btnStart"Width="50"Height="30"Margin="338,258,12,12"Click="btnStart_Click"Mou