forked from studiefredfredrik/sharpGIFs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPreviewForm.cs
More file actions
38 lines (33 loc) · 1.07 KB
/
PreviewForm.cs
File metadata and controls
38 lines (33 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
namespace sharpGIFs_2._0
{
public partial class PreviewForm : Form
{
public PreviewForm()
{
InitializeComponent();
this.Text = "Animated gif";
}
private void PreviewForm_Load(object sender, EventArgs e)
{
webBrowser1.Navigate(Application.StartupPath + "/theGIF.gif");
Image gifImg;
// Have to make sure the file is released afterwards
using (FileStream stream = new FileStream(Application.StartupPath + "/theGIF.gif", FileMode.Open, FileAccess.Read))
{
gifImg = Image.FromStream(stream);
}
this.Height = 80 + gifImg.Height;
this.Width = 70 + gifImg.Width;
}
private void PreviewForm_FormClosing(object sender, FormClosingEventArgs e)
{
// Properly dispose the viewer
webBrowser1.Navigate(new Uri("about:blank"));
webBrowser1.DocumentText = "";
}
}
}