TK.*_*TK. 8 c# wpf controls transparency winforms
我有一个WPF控件,我想覆盖到WinForms应用程序.所以我尽职尽责地创建了一个可以显示以下WPF对象的Element Host:
<UserControl x:Class="LightBoxTest.LightBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="300" Width="300" Background="Transparent">
<Grid Name="dialogHolder" Background="Transparent" Opacity="1">
<Rectangle Name="rectangle1" Stroke="White" Fill="Black" RadiusX="10" RadiusY="10" Opacity="0.5" />
<StackPanel Name="stackPanel1" Background="Transparent" Height="300" VerticalAlignment="Top">
<Rectangle Name="spacer" Opacity="0" Stroke="Gray" Fill="White" RadiusX="10" RadiusY="10" Height="100" Width="300" />
<Grid Height="100" Name="contentHolder" Width="250">
<Rectangle Name="dialog" Stroke="Gray" Fill="White" RadiusX="10" RadiusY="10" Height="100" Width="250" />
</Grid>
</StackPanel>
</Grid>
</UserControl>
Run Code Online (Sandbox Code Playgroud)
问题是WinForm表单上的控件不呈现,WPF只是在屏幕上删除它们.
元素主机创建如下:
dialogHost = new ElementHost();
dialogHost.Child = dialog;
dialogHost.BackColorTransparent = true;
dialogHost.BringToFront();
dialogHost.Show();
Run Code Online (Sandbox Code Playgroud)
有什么我应该做的,我不是吗?
是否存在关于在Winforms上显示透明WPF控件的已知问题?
任何可能有帮助的艺术品?
注意:这个问题与这个问题有关