自定义倾斜窗口中的按钮不会完全获得鼠标输入事件



这是我的代码:

 <Window x:Class="WPFStackOverFlow.SkewWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    AllowsTransparency="True" WindowStyle="None" Background="Transparent"
    Title="MainWindow" Height="600" Width="687">
<Border BorderBrush="Green" BorderThickness="2" Background="White" Width="360" Height="360">
    <Border.RenderTransform>  
        <SkewTransform AngleX="-23" AngleY="10"></SkewTransform>
    </Border.RenderTransform>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="23" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Button Grid.Row="0" Content="X" Width="23" Name="button1" HorizontalAlignment="Right" Click="button1_Click" Height="23" VerticalAlignment="Bottom"/>
        <Grid Grid.Row="1">
            <Button Height="100" Width="200"></Button>
            <TextBlock Text="Some very very long Text" HorizontalAlignment="Center"/>
        </Grid>
    </Grid>
</Border>

当我将鼠标光标移到按钮上时,有时它会获得焦点,有时不会。如何使此自定义窗口中的按钮类似于常规窗口中的按钮?

我认为你不能对窗口应用转换。

您可以将它们应用于窗口内的控件。

如果需要模拟对窗口的转换,可以尝试类似于本问题的答案中描述的内容。

最新更新