日期:2014-05-17  浏览次数:20700 次

WPF,自定义窗体,为什么右边没有光标呢?
摘自:http://www.cnblogs.com/zhoujg/archive/2010/08/17/1801271.html

参照博客园中的文章,现在写一个简单的自定义窗体:

<Window x:Class="WPF熊俊.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:WPF熊俊"
        AllowsTransparency="True" WindowStyle="None" Background="Transparent" 
        Style="{DynamicResource Mainwindow}" WindowStartupLocation="CenterScreen" >
    <Window.Resources>
        <ControlTemplate x:Key="ResizeDecoratorTemplate" TargetType="Control">
            <Grid>
                <local:ResizeThumb Height="3" Cursor="SizeNS" Margin="0 -4 0 0"
           VerticalAlignment="Top" HorizontalAlignment="Stretch"/>
                <local:ResizeThumb Width="3" Cursor="SizeWE" Margin="-4 0 0 0"
           VerticalAlignment="Stretch" HorizontalAlignment="Left"/>
                <local:ResizeThumb Width="3" Cursor="SizeWE" Margin="0 0 -4 0"
           VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
                <local:ResizeThumb Height="3" Cursor="SizeNS" Margin="0 0 0 -4"
           VerticalAlignment="Bottom"  HorizontalAlignment="Stretch"/>               
            </Grid>
        </ControlTemplate>        
        <Style x:Key="Mainwindow" TargetType="{x:Type Window}">
            <Setter Property="Template">
                <Setter.Value>