gpt4 book ai didi

wpf - 使用负边距时在控件内显示内容。

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

例如我有2个Grid,像这样:

<Grid  Height="200" Width="200" Background="Red">
<Grid HorizontalAlignment="Left" Height="100" Width="100" Background="Blue" Margin="-30,0,0,0" />
</Grid>

结果看起来:

enter image description here

如何创建在使用负边距时仅在控件内部显示的内容?
像这样:

enter image description here

最佳答案

您是否尝试过使用此处描述的剪辑:

http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.uielement.clip.aspx

像这样:

    <Grid  Height="200" Width="200" Background="Red">
<Grid.Clip>
<RectangleGeometry Rect="0,0,200,200" />
</Grid.Clip>
<Grid HorizontalAlignment="Left" Height="100" Width="100" Background="Blue" Margin="-30,0,0,0" />
</Grid>

关于wpf - 使用负边距时在控件内显示内容。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20519957/

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