반응형
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 == null) return; var SelectImage = this.listBox1.Tag as Image; int ii = SelectImage.SelectActiveFrame(FrameDimension.Time, listBox1.SelectedIndex); pictureBox1.Image = SelectImage; pictureBox1.Enabled = false; } } } | cs |
실행
'프로그래밍 > C#' 카테고리의 다른 글
[C#] 확장 메소드 (0) | 2018.10.23 |
---|---|
[C#] unsafe C#에서 포인트 사용하기 (0) | 2018.10.10 |
[C#]파일 버전 알아내기 (0) | 2018.09.13 |
[C#]cmd정보 명령 실행하고 결과 가져오기 (0) | 2018.08.09 |
[C#]Tuple 7.0부터 사용가능 (0) | 2018.07.26 |