silverlight處理gif格式圖片

來源:互聯網
上載者:User

標籤:des   style   class   blog   code   http   

1.在工具箱中添加dll檔案

2.工具列中將顯示此控制項,填寫xaml檔案

 1 <UserControl 2     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 4     xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 5     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 6  7     xmlns:Controls="clr-namespace:ImageTools.Controls;assembly=ImageTools.Controls" 8     x:Class="SilverlightApplication15.MainPage" 9 10     mc:Ignorable="d"11     d:DesignHeight="300" d:DesignWidth="400">12 13     <Grid x:Name="LayoutRoot" Background="White">14         <Controls:AnimatedImage x:Name="animatedImage1" HorizontalAlignment="Left" Height="236" Margin="36,27,0,0" VerticalAlignment="Top" Width="319"/>15     </Grid>16 </UserControl>
View Code

3.在xaml.cs編寫代碼

 1 using ImageTools; 2 using ImageTools.IO.Gif; 3 using System; 4 using System.Collections.Generic; 5 using System.Linq; 6 using System.Net; 7 using System.Windows; 8 using System.Windows.Controls; 9 using System.Windows.Documents;10 using System.Windows.Input;11 using System.Windows.Media;12 using System.Windows.Media.Animation;13 using System.Windows.Media.Imaging;14 using System.Windows.Shapes;15 16 namespace SilverlightApplication1517 {18     public partial class MainPage : UserControl19     {20         public MainPage()21         {22             InitializeComponent();23             Initializedata();24         }25         private void Initializedata()26         {27             ImageTools.IO.Decoders.AddDecoder<GifDecoder>();28             ImageTools.ExtendedImage imgt = new ImageTools.ExtendedImage();29             imgt.UriSource = new Uri("3.gif", UriKind.RelativeOrAbsolute);30             animatedImage1.Source = imgt;31         }32     }33 }
View Code


 

 

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.