1.在工具箱中添加dll文件
2.工具栏中将显示此控件,填写xaml文件
<UserControl
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" xmlns:Controls="clr-namespace:ImageTools.Controls;assembly=ImageTools.Controls"
x:Class="SilverlightApplication15.MainPage" mc:Ignorable="d"
d:DesignHeight="" d:DesignWidth=""> <Grid x:Name="LayoutRoot" Background="White">
<Controls:AnimatedImage x:Name="animatedImage1" HorizontalAlignment="Left" Height="" Margin="36,27,0,0" VerticalAlignment="Top" Width=""/>
</Grid>
</UserControl>
3.在xaml.cs编写代码
using ImageTools;
using ImageTools.IO.Gif;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes; namespace SilverlightApplication15
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
Initializedata();
}
private void Initializedata()
{
ImageTools.IO.Decoders.AddDecoder<GifDecoder>();
ImageTools.ExtendedImage imgt = new ImageTools.ExtendedImage();
imgt.UriSource = new Uri("3.gif", UriKind.RelativeOrAbsolute);
animatedImage1.Source = imgt;
}
}
}