2011-05-20 82 views
0

圖片(圖片類別)位於SMFPlayer(兩個元素均在代碼隱藏中創建)之上。圖像的Z索引是SMFPlayer + 1的Z索引。根據SMFPlayer的播放進度調整圖像大小(調整寬度)。在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)時,圖像正常。

我試圖調用圖像的更新函數,它是:bar_yellow3.UpdateLayout();但該方法不能解決閃爍的問題。

任何解決方案?

+0

你能展示你用來更新大小的方法嗎? – jv42 2011-12-21 15:47:43

回答

0

嘗試使用效果(Shazzam將幫助您),而不是使用Z順序。

+0

你能否詳細說明你的答案(喜歡舉例)? – Raptor 2013-07-09 12:28:27