WPF我在表单AllowTransparency = true时无法获取MouseMove事件

时间:2015-01-16 02:59:15

标签: wpf transparent

<Window x:Class="mtWPFScratchPad.DeskForm"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="mtWPFScratchPad"  AllowsTransparency="True" WindowState="Maximized" Loaded="Window_Loaded"  WindowStyle="None" Background="#00FFFFFF" Closing="Window_Closing"  Topmost="True" MouseMove="Window_MouseMove">
<InkCanvas Name="inkCanv"   Background="Transparent">

</InkCanvas>

当我设置窗口时应该是透明的。我无法获取mousemove事件。 怎么做?

1 个答案:

答案 0 :(得分:0)

    如果将两者设置为透明它不起作用您必须更改墨迹画布颜色或更改允许透明度=假

<Window x:Class="Demo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" AllowsTransparency="True"  WindowState="Normal Loaded="Window_Loaded_1" WindowStyle="None" Background="#00FFFFFF" Closing="Window_Closing_1" Topmost="True" MouseMove="Window_MouseMove_1" Height="350" Width="525" >
    <Grid>
        <InkCanvas Name="inkCanvas" Background="White">

        </InkCanvas>

    </Grid>
</Window>