<Window x:Class="WpfApplication1.Window6"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window6" Height="300" Width="300">
<Image>
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<GeometryDrawing>
<GeometryDrawing.Pen>
<Pen Brush="Blue" Thickness="30"/>
</GeometryDrawing.Pen>
<GeometryDrawing.Geometry>
<PathGeometry>
<PathFigure StartPoint="10,100">
<LineSegment x:Name="line1" Point="10,100" IsSmoothJoin="True"/>
<LineSegment x:Name="line2" Point="10,100" IsSmoothJoin="True"/>
</PathFigure>
</PathGeometry>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
<Image.Triggers>
<EventTrigger RoutedEvent="Image.Loaded">
<BeginStoryboard>
<Storyboard RepeatBehavior="Forever">
<PointAnimation Storyboard.TargetName="line1" Storyboard.TargetProperty="Point" From="10,100" To="100,200" Duration="0:0:2" BeginTime="0:0:1"/>
<PointAnimation Storyboard.TargetName="line2" Storyboard.TargetProperty="Point" From="100,200" To="200,10" Duration="0:0:2" BeginTime="0:0:3"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Image.Triggers>
</Image>
</window>
用一个image显示一个简单的“打钩”效果的动画,但整个image会随着动画的过程而改变自身的大小,我想实现的是image大小固定,然后动画中的点是相对于image的位置,而不是相对于window。
当然,如果有更好的实现“打钩”动画的方法也可以介绍给我,本人新手,说的时候详细点,谢谢。
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window6" Height="300" Width="300">
<Image>
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<GeometryDrawing>
<GeometryDrawing.Pen>
<Pen Brush="Blue" Thickness="30"/>
</GeometryDrawing.Pen>
<GeometryDrawing.Geometry>
<PathGeometry>
<PathFigure StartPoint="10,100">
<LineSegment x:Name="line1" Point="10,100" IsSmoothJoin="True"/>
<LineSegment x:Name="line2" Point="10,100" IsSmoothJoin="True"/>
</PathFigure>
</PathGeometry>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
<Image.Triggers>
<EventTrigger RoutedEvent="Image.Loaded">
<BeginStoryboard>
<Storyboard RepeatBehavior="Forever">
<PointAnimation Storyboard.TargetName="line1" Storyboard.TargetProperty="Point" From="10,100" To="100,200" Duration="0:0:2" BeginTime="0:0:1"/>
<PointAnimation Storyboard.TargetName="line2" Storyboard.TargetProperty="Point" From="100,200" To="200,10" Duration="0:0:2" BeginTime="0:0:3"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Image.Triggers>
</Image>
</window>
用一个image显示一个简单的“打钩”效果的动画,但整个image会随着动画的过程而改变自身的大小,我想实现的是image大小固定,然后动画中的点是相对于image的位置,而不是相对于window。
当然,如果有更好的实现“打钩”动画的方法也可以介绍给我,本人新手,说的时候详细点,谢谢。
解决方案 »
- 关于webBrowser控件如何执行js的问题,求解答!!!![标题要长!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!]
- sql查询显示在datagridview中
- windows ce(C#语言) 怎么实现打印功能
- 如何取消控件背景图,用GDI画上的
- 请大大们指教!
- 如何更新数据库某几列的所有值
- C#2.0 DataList显示记录时,如果没有任何记录则DataList显示'没有数据',怎么实现啊??
- 如何取datagridview行的状态(add,modiff,delete)
- 自定义组件--动态创建的控件无法正常显示
- 考考您的c基礎
- C# 数字转条形码的问题
- 如何实时响应这种需求??
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window6" Height="500" Width="500"> <Image Stretch="None">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup>
<GeometryDrawing>
<GeometryDrawing.Pen>
<Pen Brush="Transparent" Thickness="30"/>
</GeometryDrawing.Pen>
<GeometryDrawing.Geometry>
<PathGeometry>
<PathFigure StartPoint="10,100">
<LineSegment x:Name="line3" Point="100,200" IsSmoothJoin="True"/>
<LineSegment x:Name="line4" Point="200,10" IsSmoothJoin="True"/>
</PathFigure>
</PathGeometry>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing>
<GeometryDrawing.Pen>
<Pen Brush="Blue" Thickness="30"/>
</GeometryDrawing.Pen>
<GeometryDrawing.Geometry>
<PathGeometry>
<PathFigure StartPoint="10,100">
<LineSegment x:Name="line1" Point="10,100" IsSmoothJoin="True"/>
<LineSegment x:Name="line2" Point="10,100" IsSmoothJoin="True"/>
</PathFigure>
</PathGeometry>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
<Image.Triggers>
<EventTrigger RoutedEvent="Image.Loaded">
<BeginStoryboard>
<Storyboard RepeatBehavior="Forever">
<PointAnimation Storyboard.TargetName="line1" Storyboard.TargetProperty="Point" From="10,100" To="100,200" Duration="0:0:1" BeginTime="0:0:1"/>
<PointAnimation Storyboard.TargetName="line2" Storyboard.TargetProperty="Point" From="100,200" To="200,10" Duration="0:0:1" BeginTime="0:0:2"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Image.Triggers>
</Image></Window>
问题已解决,通过先画一个透明的相同图形,即可达到固定画面的作用。开始送分,欢迎回复