如何修整网格的角并删除背景?

时间:2018-06-27 21:04:48

标签: c# wpf xaml mvvm

我正在尝试对顶部角进行倒圆角处理,并删除我切出的部分,因此弯曲外部的外部不在内部。 这就是我到目前为止 我试图弯曲网格,而不是enter image description here

但是我不确定如何“裁剪”

<Window x:Class="Ah.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Ah"
        mc:Ignorable="d"
        WindowStyle="None" AllowsTransparency="True" Background="Transparent" ResizeMode="NoResize" Height="550" Width="1000">
    <Grid Background="White">
        <Border BorderBrush="Red" BorderThickness="2" CornerRadius="50,50,0,0">

        </Border>
    </Grid>
</Window>

2 个答案:

答案 0 :(得分:1)

解决了。我决定使MainWindow透明,然后创建两个网格,一个在顶部带有弯曲的网格,另一个在其下方容纳所有控件,因此现在看起来像这样

enter image description here

享受做同一件事的人

Private Sub cmdAdd_Click()
    'add to apartment
    CurrentDb.Execute " INSERT INTO Apartment(Apartment, Account_ID, Total_area, Heated_area, People) " & _
           " VALUES ( " & Me.txtApt & ",'" & Me.txtAcc & "','" & _
           Me.txtTotal_area & "','" & Me.txtHeated_area & "','" & Me.txtPeople & "')"
    'add to owner
    CurrentDb.Execute " INSERT INTO Owner (Account, FName, LName, MName) " & _
           " VALUES ( " & Me.txtAcc & ",'" & Me.txtFName & "','" & _
           Me.txtLName & "','" & Me.txtMName & "')"
    'clear
    cmdClear_Click

    'subform requery
    frmAptSub.Form.Requery
End Sub    

答案 1 :(得分:0)

您可以设置边框的背景:

<Grid Background="White">
    <Border Background="Red" BorderBrush="White" BorderThickness="2" CornerRadius="50,50,0,0">
    </Border>
</Grid>

哪个会给你这个:

Will give you this