零基础学通Silverlight4(9):多媒体
时间:2010-10-13 来源:wanxl
Silverlight等软件,由于Silverlight软件,这是最基本的必要条件。
)继承自UIElent:获取或设置是否自动播放Source:获取或设置左右音量平衡比例,属性值为-1值,默认为0。
◎ BufferingProgress:获取或设置媒体的伸展模式。
◎ Volume音频:
<MediaElement x:Name="MyAudio" AutoPlay="True" Volume="1" Source="tt.mp3" Canvas.Left="59" Canvas.Top="102"/>
图9-1图9-1
图9-1图9-1
◎ 图9-2
◎ 图9-3
◎标记如下:
<Grid x:Name="LayoutRoot" Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="189*" />
<RowDefinition Height="36*" />
<RowDefinition Height="75*" />
</Grid.RowDefinitions>
<Border x:Name="bordVider" Margin="3" CornerRadius="3" Width="400" BorderBrush="Gray" HorizontalAlignment="Left" BorderThickness="1" >
<Border.Background>
<VideoBrush x:Name="brshMyVideo"/>
</Border.Background>
</Border>
<Button Name="btStart" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Row="1"
Width="78" Height="33"
Content="截屏" Height="33" HorizontalAlignment="Left" Margin="196,0,0,0" Name="btPing" VerticalAlignment="Top" Width="78" Grid.Row="1" FontSize="14" Click="btPing_Click" />
<Image Grid.Row="2" Height="70" HorizontalAlignment="Left" Margin="20,5,0,0" Name="imgMy" Stretch="UniformToFill" VerticalAlignment="Top" Width="99" />
</Grid>
</UserControl>
◎ 创建视频捕获源
capSource = new CaptureSource();
if (CaptureDeviceConfiguration.RequestDeviceAccess())
{
//关闭摄像头
capSource.Stop();
}
private void btPing_Click(object sender, RoutedEventArgs e)
{
if (capSource.State == CaptureState.Started)
{
WriteableBitmap wBitmap = new WriteableBitmap(bordVider, new MatrixTransform());
imgMy.Source = wBitmap;
}
}
相关阅读 更多 +
◎ 图9-3
◎标记如下:
<Grid x:Name="LayoutRoot" Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="189*" />
<RowDefinition Height="36*" />
<RowDefinition Height="75*" />
</Grid.RowDefinitions>
<Border x:Name="bordVider" Margin="3" CornerRadius="3" Width="400" BorderBrush="Gray" HorizontalAlignment="Left" BorderThickness="1" >
<Border.Background>
<VideoBrush x:Name="brshMyVideo"/>
</Border.Background>
</Border>
<Button Name="btStart" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Row="1"
Width="78" Height="33"
Content="截屏" Height="33" HorizontalAlignment="Left" Margin="196,0,0,0" Name="btPing" VerticalAlignment="Top" Width="78" Grid.Row="1" FontSize="14" Click="btPing_Click" />
<Image Grid.Row="2" Height="70" HorizontalAlignment="Left" Margin="20,5,0,0" Name="imgMy" Stretch="UniformToFill" VerticalAlignment="Top" Width="99" />
</Grid>
</UserControl>
◎ 创建视频捕获源
capSource = new CaptureSource();
if (CaptureDeviceConfiguration.RequestDeviceAccess())
{
//关闭摄像头
capSource.Stop();
}
private void btPing_Click(object sender, RoutedEventArgs e)
{
if (capSource.State == CaptureState.Started)
{
WriteableBitmap wBitmap = new WriteableBitmap(bordVider, new MatrixTransform());
imgMy.Source = wBitmap;
}
}
相关阅读 更多 +