名字里面放视频
来源:互联网 发布:ipad桌面图标整理软件 编辑:程序博客网 时间:2024/04/29 15:13
界面上
<Window x:Class="nameVedio.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Viewbox Stretch="Uniform">
<Canvas
Name="canvas"
Background="Black"
Width="400"
Height="300">
<!-- 設定要播放的影片 -->
<MediaElement
Canvas.Top="10"
Canvas.Left="40"
Name="myMediaElement">
<MediaElement.Triggers>
<EventTrigger RoutedEvent="MediaElement.Loaded">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<MediaTimeline Source="xbox.wmv" Storyboard.TargetName="myMediaElement"
RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</MediaElement.Triggers>
</MediaElement>
<!-- 定義用來裁剪影片和小白球動畫的路徑 -->
<!-- 為了讓影片可以透出來,所以 Fill 屬性要設定成 Transparent -->
<Path
Canvas.Top="10"
Canvas.Left="40"
Name="path"
Stroke="Gray"
Fill="Transparent" />
<!-- 定義小白球 -->
<!-- 座標是相對於路徑的相對座標 -->
<Ellipse
Visibility="Hidden"
Name="ellipse"
Canvas.Top="0"
Canvas.Left="30"
Width="20"
Height="20">
<Ellipse.Fill>
<RadialGradientBrush>
<GradientStop Color="#ffff" Offset="0"/>
<GradientStop Color="#0fff" Offset="1"/>
</RadialGradientBrush>
</Ellipse.Fill>
<Ellipse.RenderTransform>
<MatrixTransform />
</Ellipse.RenderTransform>
<Ellipse.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard x:Name="storyboard">
<MatrixAnimationUsingPath
x:Name="matrixAnimation"
Duration="0:00:59"
RepeatBehavior="Forever"
Storyboard.TargetProperty="RenderTransform.Matrix" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Ellipse.Triggers>
</Ellipse>
</Canvas>
</Viewbox>
</Window>
后台代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace nameVedio
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
// 建立格式化文字物件
FormattedText formattedText = new FormattedText(
"姜一多",
new System.Globalization.CultureInfo("zh-TW"),
FlowDirection.LeftToRight,
new Typeface(
new FontFamily("楷体"),
FontStyles.Normal,
FontWeights.Bold,
FontStretches.Normal),
120,
Brushes.Red);
// 建立文字外框的幾何物件
Geometry geometry = new PathGeometry();
geometry = formattedText.BuildGeometry(new Point(0, 0));
// 調整幾何的比例,以便於可以和影片100% 重疊在一起
ScaleTransform myScaleTransform = new ScaleTransform();
myScaleTransform.ScaleX = .85;
myScaleTransform.ScaleY = 1.85;
geometry.Transform = myScaleTransform;
// 建立路徑幾何
PathGeometry pathGeometry = new PathGeometry();
pathGeometry = geometry.GetFlattenedPathGeometry();
//1. 套用到 XAML 中的 PATH 物件
path.Data = pathGeometry;
// 2. 使用路徑幾何來裁剪影片
myMediaElement.Clip = pathGeometry;
// 3. 讓白色小球依照字型外框移動
//matrixAnimation.PathGeometry = pathGeometry;
//ellipse.Visibility = Visibility.Visible;
}
}
}
路径放好就可以了
- 名字里面放视频
- 放播视频
- android----视频放缩
- 为何10M多的视频传不上sae云应用的目录,是不是要放在sae云存储里面??
- goacademic视频流播放技术
- 在LATEX里面修改算法名字
- 循环时,对象放里面,放外面的问题
- 修改tomcat里面的jsession里面的名字
- datalist里面放一个嵌套的datagrid
- 在TableViewCell里面放一个自定义Label
- 一个label 里面放不同颜色的字
- html5-"head" 标签里面应该放什么
- AE 视频画面静止 快放 慢放
- 视频名字显示不全的解决方案
- Qt+OpenCV以时间命名视频名字
- 在unity3d里面播放视频
- 在unity3d里面播放视频
- 在Dialog里面播放视频
- Android ADT插件配置
- Struts2中一个Action多个请求处理方法的三种实现方式
- Steps of starting an AWS EC2 instance
- linux内核部件分析(四)——更强的链表klist
- JSP基础语法:注释、Scriptlet、编译指令
- 名字里面放视频
- 关于allocator的一个例子
- java面试中常用到的位运算符解析
- 2008 R2/IIS 7.5下连接Access数据库
- poj 2823 Sliding Window 双向队列,学习
- STL 容器
- 梅花规格参照表
- 解题笔记(38)——大整数阶乘计算
- hdu 1016Prime Ring Problem