0
我正在嘗試使用MediaPlayer類來顯示視頻。我正在看一個codeProject的例子。如何伸展System.Windows.Media.MediaPlayer?
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
MediaTimeline timeline =
new MediaTimeline(new Uri("airplane.mpg", UriKind.Relative));
timeline.RepeatBehavior = RepeatBehavior.Forever;
MediaClock clock = timeline.CreateClock();
MediaPlayer player = new MediaPlayer();
player.Clock = clock;
VideoDrawing drawing = new VideoDrawing();
drawing.Rect = new Rect(0, 0, 300, 200);
drawing.Player = player;
DrawingBrush brush = new DrawingBrush(drawing);
this.Background = brush;
}
}
一切工作得很好,但我不知道如何拉伸視頻。除了使用視框,沒有人知道如何使用System.Windows.Media.Stretch來改變視頻大小? (請不要使用MediaElement或WpfMediakit或其他類或外部庫,這個問題是專門爲System.Windows.Media.MediaPlayer)。