0
我想在WindowsFormsHost
上創建邊框。如何做?如何在.cs文件和XAML文件中的元素周圍創建綠線邊框
在cs文件:
WindowsFormsHost Host = new WindowsFormsHost();
和在XAML:
<WindowsFormsHost x:Name="Host"></WindowsFormsHost>
我想在WindowsFormsHost
上創建邊框。如何做?如何在.cs文件和XAML文件中的元素周圍創建綠線邊框
在cs文件:
WindowsFormsHost Host = new WindowsFormsHost();
和在XAML:
<WindowsFormsHost x:Name="Host"></WindowsFormsHost>
的System.Windows.Border
類是一類Decorator
,這意味着它可以具有單個Child
元件。在這種情況下,您的孩子將是WindowsFormsHost
。
XAML:
<Border BorderBrush="Green" BorderThickness="1">
<WindowsFormsHost x:Name="Host"></WindowsFormsHost>
</Border>
使用border類:
XAML:
<Border BorderThickness="1" BorderBrush="Green">
<WindowsFormsHost x:Name="Host"></WindowsFormsHost>
</Border>
CS:
var myBorder = new Border();
myBorder.BorderBrush = Brushes.Green;
myBorder.BorderThickness = new Thickness(1);
myBorder.Child = new WindowsFormsHost();