gpt4 book ai didi

c# - wpf 在 activeX 之上

转载 作者:太空狗 更新时间:2023-10-29 23:08:48 28 4
gpt4 key购买 nike

我正在尝试在包含嵌入 VLC 的 activeX 控件的 WindowsFormsHost 上覆盖按钮。我遇到的问题是 activeX 总是在 wpf 之上。有什么方法可以让 wpf 控制 activeX 控件吗?

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

最佳答案

我终于找到了解决办法。弹出基元也是一个始终位于顶部的元素,可以放置在 vlc 控件之上。它有点 hack,但它得到了我需要的覆盖。我的播放器 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 放在控件上的问题已经解决。

关于c# - wpf 在 activeX 之上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15250011/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com