8,707
社区成员




<Style x:Name="MyPointStyle" TargetType="DeepProtoControls:MyPoint" >
<Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
<Setter Property="AnchorPoint" Value="0.5,0.5" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DeepProtoControls:MyPoint" >
<Grid x:Name="_LayoutRoot">
<Image x:Name="_Image" Stretch="UniformToFill" Height="24" Width="24" Canvas.ZIndex="2" Source="Resources/red.PNG" ToolTipService.Placement="Top">
<Image.RenderTransform>
<RotateTransform x:Name="shipTransform" CenterX="12" CenterY="12"/>
</Image.RenderTransform>
</Image>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<UserControl xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" x:Class="SL3madaming.MainPage"
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"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<UserControl.Resources >
<Style x:Key="buttonVSM2" TargetType="Button">
<!--定义样式-->
<Setter Property="Cursor" Value="hand"></Setter>
<Setter Property="Foreground" Value="White"></Setter>
<Setter Property="Template" >
<Setter.Value >
<!--定义控件模板-->
<ControlTemplate TargetType="Button">
<Grid>
<Image x:Name="image_normal" Source="/Resources/Assets/win7-2.jpg" Opacity="1" Stretch="Fill" ></Image>
<Image x:Name="image_mouse_over" Source="/Resources/Assets/win7-3.jpg" Opacity="0" Stretch="Fill" ></Image>
<Image x:Name="image_press" Source="/Resources/Assets/win7-4.jpg" Opacity="0" Stretch="Fill" ></Image>
<!--视觉管理组-->
<VisualStateManager.VisualStateGroups >
<VisualStateGroup >
<!--普通状态-->
<VisualState x:Name="Normal">
<Storyboard >
<DoubleAnimation Storyboard.TargetName="image_normal" Storyboard.TargetProperty="Opacity" To="1" ></DoubleAnimation>
<DoubleAnimation Storyboard.TargetName="image_mouse_over" Storyboard.TargetProperty="Opacity" To="0" ></DoubleAnimation>
<DoubleAnimation Storyboard.TargetName="image_press" Storyboard.TargetProperty="Opacity" To="0" ></DoubleAnimation>
</Storyboard>
</VisualState>
<!--鼠标经过-->
<VisualState x:Name="MouseOver">
<Storyboard >
<DoubleAnimation Storyboard.TargetName="image_normal" Storyboard.TargetProperty="Opacity" To="0" ></DoubleAnimation>
<DoubleAnimation Storyboard.TargetName="image_mouse_over" Storyboard.TargetProperty="Opacity" To="1" ></DoubleAnimation>
<DoubleAnimation Storyboard.TargetName="image_press" Storyboard.TargetProperty="Opacity" To="0" ></DoubleAnimation>
</Storyboard>
</VisualState>
<!--按下按钮-->
<VisualState x:Name="Pressed">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="image_normal" Storyboard.TargetProperty="Opacity" To="0" ></DoubleAnimation>
<DoubleAnimation Storyboard.TargetName="image_mouse_over" Storyboard.TargetProperty="Opacity" To="0" ></DoubleAnimation>
<DoubleAnimation Storyboard.TargetName="image_press" Storyboard.TargetProperty="Opacity" To="1" ></DoubleAnimation>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid x:Name="LayoutRoot">
<StackPanel>
<Button x:Name="button_style" Width="50" Height="50" Margin="5" Style ="{StaticResource buttonVSM2}"></Button>
</StackPanel>
</Grid>
</UserControl>