gpt4 book ai didi

image - 带有背景图像和颜色的网格

转载 作者:行者123 更新时间:2023-12-04 00:15:02 25 4
gpt4 key购买 nike

是否可以在 xaml 中为整个网格提供背景图像和颜色?我没有缩放图像,所以有些区域没有颜色。是否可以用颜色为网格的其余部分着色?

这是我当前的代码:

<Grid>
<Grid.Background>
<ImageBrush Stretch="None" ImageSource="Images/background_top.png" AlignmentY="Top" AlignmentX="Center"/>
</Grid.Background>

<Grid.RowDefinitions>
<RowDefinition Height="50*" />
<RowDefinition Height="50*" />
</Grid.RowDefinitions>
</Grid>

最佳答案

我能想到的唯一方法是使用背景属性设置颜色,然后将图像添加到网格,确保跨越所有行和列。只要图像是网格中的第一个项目,其他项目将在顶部分层。我相信它会给你你正在寻找的效果。

<Grid Background="Red">
<Image Grid.RowSpan="2" Stretch="None" Source="Images/background_top.png" VerticalAlignment="Top" HorizontalAlignment="Center"/>
<Label Content="Label" Grid.Row="0" Height="28" HorizontalAlignment="Center" Margin="10,10,0,0" Name="label1" VerticalAlignment="Top" />
<Grid.RowDefinitions>
<RowDefinition Height="50*" />
<RowDefinition Height="50*" />
</Grid.RowDefinitions>
</Grid>

关于image - 带有背景图像和颜色的网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14085164/

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