6
如何在C#周圍圖像黑色邊框的包裹物面板邊框圖像在C#
如何在C#周圍圖像黑色邊框的包裹物面板邊框圖像在C#
只是一個邊框添加到圖片:
<toolkit:WrapPanel x:Name="wp">
<Border BorderBrush="Black" BorderThickness="5" >
<Image Source="myimage.png" />
</Border>
</toolkit:WrapPanel>
或者它的代碼添加到WrapPanel:
var b = new Border
{
BorderBrush = new SolidColorBrush(Colors.Black),
BorderThickness = new Thickness(5)
};
var bi = new BitmapImage
{
UriSource = new Uri("/myimage.png", UriKind.Relative)
};
b.Child = new Image {Source = bi};
wp.Children.Add(b);
內.the圖像存在使用邊界元素,並將其配置和背景設置爲你的圖像作爲源圖像刷。
Here's一些XAML:
<Border BorderBrush="Black">
<Border.Background>
<ImageBrush ImageSource="<Your Image>"/>
</Border.Background>
</Border>
您也可以在邊界定義CornerRadius使圓角。這也將適用於圖像。
thanx的reply..but我添加圖像編程包裹面板。我怎樣才能以編程方式添加邊框? – Shaireen 2010-12-23 10:25:07