wpf over activeX

Mit*_*tch 5 c# wpf vlc

我试图覆盖WindowsFormsHost上的按钮,其中包含嵌入VLC的activeX控件.我遇到的问题是activeX始终位于wpf之上.有没有办法获得对activeX控件的wpf控制?

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

Mit*_*tch 4

我终于找到了解决办法。弹出原语也是一个始终位于顶部的元素,可以放置在 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>
Run Code Online (Sandbox Code Playgroud)

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