2013-03-06 49 views
4

我想覆盖包含ActiveX控件嵌入VLC的WindowsFormsHost上的按钮。我的问题是,activeX始终在wpf之上。有没有什么办法可以通过对activeX控件进行wpf控制?wpf over activeX

VLC控件似乎也不支持渲染到位图。

回答

4

我终于找到了解决办法。 popup基元也是一个始终位于顶部并且可以放置在vlc控件上的元素。它有点破解,但它得到我需要的覆盖。我的球员xaml看起来像这样

<grid> 
    <WindowsFormsHost x:Name="Host" 
         Height="200" 
         Width="200" /> 
    <Border x:Name="Anchor" 
      Height="0" 
      Width="0" 
      HorizontalAlignment="Left" 
      VerticalAlignment="Top" /> 
    <Popup Width="{Binding ElementName=Host,Path=Width}" 
      Height="{Binding ElementName=Host,Path=Height}" 
      PlacementTarget="{Binding ElementName=Anchor}" 
      AllowsTransparency="True" 
      IsOpen="True"> 
     <Border Background="#30808080" 
       Width="{Binding ElementName=Host,Path=Width}" 
       Height="{Binding ElementName=Host,Path=Height}"> 
      <Button Content="Start" 
        Height="20" 
        Width="60" 
        Click="button1_Click"/> 
     </Border> 

    </Popup> 
</grid> 

上面在包含按钮的vlc播放器上放置了一个浅灰色透明层。上述内容并没有说明窗口是否调整大小或移动了,但是将wpf放在控件上的问题已经解决。

1

短的答案:号

MSDN提取:

在WPF用户界面,可以元素的z顺序更改为 控制重叠行为。托管的Windows窗体控件在单独的HWND中绘制为 ,因此它总是绘制在WPF元素的顶部。