달력

12025  이전 다음

  • 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
반응형

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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace WinApp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFile = new OpenFileDialog();
            openFile.Filter = @"GIF|*.gif";
            openFile.Multiselect = false;
            openFile.ShowDialog();
 
            if (openFile.FileName.Length > 0)
            {
                Image SelectImage = Image.FromFile(openFile.FileName);
                int intFrameCnt = SelectImage.GetFrameCount(FrameDimension.Time);
 
                this.listBox1.Items.Clear();
                this.listBox1.Tag = SelectImage;
 
                for (int i = 0; i < intFrameCnt; i++)
                {
                    this.listBox1.Items.Add(i.ToString());                    
                }
            }
        }
 
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.listBox1.Tag == nullreturn;
            var SelectImage = this.listBox1.Tag as Image;
 
            int ii = SelectImage.SelectActiveFrame(FrameDimension.Time, listBox1.SelectedIndex);
            pictureBox1.Image = SelectImage;
            pictureBox1.Enabled = false;
        }
    }
}
 
cs

실행


Posted by 유령회사
|