在SMFPlayer问题上方显示图像

时间:2011-05-20 07:12:45

标签: c# silverlight-4.0 smf mmppf

图像(图像类)位于 SMFPlayer 上方(两个元素都在代码隐藏中创建)。图像的Z-index是SMFPlayer + 1的Z-Index。根据SMFPlayer的播放进度调整图像大小(调整宽度)。

    videoPlayer = new SMFPlayer();
    videoPlayer.Width = 1920;
    videoPlayer.Height = 1080;
    videoPlayer.Margin = new Thickness(1920, 0, 0, 0);
    PlaylistItem item = new PlaylistItem();
    Random r = new Random();
    item.MediaSource = new Uri("video.wmv");
    item.DeliveryMethod = DeliveryMethods.ProgressiveDownload;
    videoPlayer.Playlist.Add(item);
    videoPlayer.AutoPlay = true;
    videoPlayer.AutoLoad = true;
    videoPlayer.IsControlStripVisible = false;
    videoPlayer.PlaylistVisibility = FeatureVisibility.Disabled;
    videoPlayer.MediaEnded += new EventHandler(player_MediaEnded);
    LayoutRoot.Children.Add(videoPlayer);

            bar_yellow3 = new Image();
            bar_yellow3.Source = new BitmapImage(new Uri("/SMF_ProgressiveDownload1;component/assets/bar_y.png", UriKind.Relative));
            bar_yellow3.Width = 775;
            bar_yellow3.Height = 34;
            bar_yellow3.Margin = new Thickness(2948,1034,0,0);
            bar_yellow3.Stretch = Stretch.Fill;
            bar_yellow3.VerticalAlignment = VerticalAlignment.Top;
            bar_yellow3.HorizontalAlignment = HorizontalAlignment.Left;
            LayoutRoot.Children.Add(bar_yellow3);

但是,当播放进度小于20%时,图像会随机闪烁。当SMFPlayer设置为不可见(Visibility.Collapsed)时,图像是正常的。

我试图调用Image的更新功能,即: bar_yellow3.UpdateLayout(); 但该方法无法解决闪烁问题。

任何解决方案?

1 个答案:

答案 0 :(得分:0)

尝试使用效果(Shazzam会帮助你)而不是使用Z顺序。