سلام خدمت کاربران وب سایت پروگرم 98 😉 در این پست کد ImageBrush و Stretch=Fill با wpf و #C را آماده کردم. انشاالله که این کد براتون مفید باشه.
تصاویر خروجی نهایی این کد:
کد ImageBrush و Stretch=Fill با wpf و #C :
<Window x:Class="Chapter05.ImageBrushExample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Chapter05" Height="300" Width="300">
<StackPanel Margin="5" Grid.Column="1" Grid.Row="0">
<TextBlock Margin="5" Text="Stretch = Fill" />
<Button Width="135" Height="100">
<Button.Background>
<ImageBrush ImageSource="c:\image.jpg" Stretch="Fill" />
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Chapter05" Height="300" Width="300">
<StackPanel Margin="5" Grid.Column="1" Grid.Row="0">
<TextBlock Margin="5" Text="Stretch = Fill" />
<Button Width="135" Height="100">
<Button.Background>
<ImageBrush ImageSource="c:\image.jpg" Stretch="Fill" />